improve:进程保护
This commit is contained in:
@@ -64,13 +64,11 @@ namespace Ink_Canvas.Helpers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Interlocked.Exchange(ref _writeGate, 1) == 1)
|
var waitStart = Environment.TickCount;
|
||||||
|
while (Interlocked.CompareExchange(ref _writeGate, 1, 0) != 0)
|
||||||
{
|
{
|
||||||
var start = Environment.TickCount;
|
if (Environment.TickCount - waitStart < 2000) Thread.Sleep(10);
|
||||||
while (Interlocked.CompareExchange(ref _writeGate, 1, 1) == 1 && Environment.TickCount - start < 2000)
|
else Thread.Sleep(50);
|
||||||
{
|
|
||||||
Thread.Sleep(10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var normalized = NormalizePath(targetPath);
|
var normalized = NormalizePath(targetPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user