repo: Make sure there is always only one buffer/sync thread on file activity. Closes #982
This commit is contained in:
parent
0286060d9a
commit
1c156b5e5d
|
@ -209,23 +209,26 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Object buffer_lock = new Object ();
|
||||||
|
|
||||||
public void OnFileActivity (FileSystemEventArgs args)
|
public void OnFileActivity (FileSystemEventArgs args)
|
||||||
{
|
{
|
||||||
if (IsBuffering)
|
if (IsBuffering)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ChangesDetected ();
|
|
||||||
string relative_path = args.FullPath.Replace (LocalPath, "");
|
|
||||||
|
|
||||||
foreach (string exclude_path in ExcludePaths) {
|
foreach (string exclude_path in ExcludePaths) {
|
||||||
if (relative_path.Contains (exclude_path))
|
if (args.FullPath.Contains (exclude_path))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock (this.buffer_lock) {
|
||||||
if (IsBuffering || !HasLocalChanges)
|
if (IsBuffering || !HasLocalChanges)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IsBuffering = true;
|
IsBuffering = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ChangesDetected ();
|
||||||
|
|
||||||
if (!UseCustomWatcher)
|
if (!UseCustomWatcher)
|
||||||
this.watcher.Disable ();
|
this.watcher.Disable ();
|
||||||
|
|
Loading…
Reference in a new issue