Index: src/engine/main.cpp |
=================================================================== |
--- a/src/engine/main.cpp |
+++ b/src/engine/main.cpp |
@@ -187,12 +187,11 @@ |
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) |
{ |
- // TODO: Attempt to create the pipe first, and exit immediately if this |
- // fails. Since multiple instances of the engine could be running, |
- // this may need named mutices to avoid race conditions. |
- // Note that as soon as the pipe is created first, we can reduce the |
- // client timeout after CreateProcess(), but should increase the one |
- // in WaitNamedPipe(). |
+ if (Communication::PipeExists(Communication::pipeName)) |
+ { |
+ DebugLastError("Named pipe exists, another engine instance appears to be running"); |
+ return 1; |
+ } |
Wladimir Palant
2013/06/07 06:16:08
That's causing a race condition. It can take sever
Felix Dahlke
2013/06/07 06:37:22
Hm, you're right, this actually shouldn't work. Ma
|
int argc; |
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); |