mirror of
https://github.com/cadmium-im/zirconium-sharp.git
synced 2024-11-22 02:12:22 +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
|
||||
bin
|
||||
obj
|
||||
/.plugins
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using CommandLine;
|
||||
using Nett;
|
||||
using Zirconium.Core.Logging;
|
||||
@ -12,7 +13,7 @@ namespace Zirconium.Core
|
||||
}
|
||||
class Program
|
||||
{
|
||||
private static bool keepRunning = true;
|
||||
private static EventWaitHandle wailtHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
@ -45,9 +46,9 @@ namespace Zirconium.Core
|
||||
{
|
||||
e.Cancel = true;
|
||||
app.Destroy();
|
||||
keepRunning = false;
|
||||
wailtHandle.Set();
|
||||
};
|
||||
while(keepRunning) {}
|
||||
wailtHandle.WaitOne();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user