mirror of
https://github.com/cadmium-im/zirconium-sharp.git
synced 2024-11-22 10:22:23 +00:00
Optimize waiting process for keeping the process running (replace while loop with EventWaitHandle)
This commit is contained in:
parent
0f15340065
commit
48d27401ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
/.config.toml
|
/.config.toml
|
||||||
bin
|
bin
|
||||||
obj
|
obj
|
||||||
|
/.plugins
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using Nett;
|
using Nett;
|
||||||
using Zirconium.Core.Logging;
|
using Zirconium.Core.Logging;
|
||||||
@ -12,7 +13,7 @@ namespace Zirconium.Core
|
|||||||
}
|
}
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
private static bool keepRunning = true;
|
private static EventWaitHandle wailtHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
@ -45,9 +46,9 @@ namespace Zirconium.Core
|
|||||||
{
|
{
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
app.Destroy();
|
app.Destroy();
|
||||||
keepRunning = false;
|
wailtHandle.Set();
|
||||||
};
|
};
|
||||||
while(keepRunning) {}
|
wailtHandle.WaitOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user