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

Unified Diff: src/engine/main.cpp

Issue 10891004: Use a named mutex to avoid race conditions (Closed)
Patch Set: Created June 7, 2013, 8:05 a.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,7 +187,14 @@
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
- if (Communication::PipeExists(Communication::pipeName))
+ AutoHandle mutex(CreateMutexW(0, false, L"AdblockPlusEngine"));
Oleksandr 2013/06/07 14:52:09 Shouldn't this be Global\AdblockPlusEngine?
+ if (!mutex)
+ {
+ DebugLastError("CreateMutex failed");
+ return 1;
+ }
+
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
{
DebugLastError("Named pipe exists, another engine instance appears to be running");
return 1;
« 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