Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/engine/main.cpp

Issue 10809053: Terminate the engine if another instance is already running (Closed)
Patch Set: Created June 6, 2013, 1:43 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/shared/Communication.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | src/shared/Communication.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld