switching to semaphore
authorVolker Birk <vb@pep-project.org>
Sat, 12 Nov 2016 21:44:02 +0100
changeset 205db006c43bb2a
parent 204 21b7749b5beb
child 206 14b271aedb82
switching to semaphore
GateKeeper.cpp
     1.1 --- a/GateKeeper.cpp	Sat Nov 12 00:29:25 2016 +0100
     1.2 +++ b/GateKeeper.cpp	Sat Nov 12 21:44:02 2016 +0100
     1.3 @@ -380,11 +380,11 @@
     1.4      void GateKeeper::update_product(product p, DWORD context)
     1.5      {
     1.6  		{
     1.7 -			HANDLE hMutex = CreateMutex(NULL, TRUE, _T("PEPINSTALLERMUTEX"));
     1.8 -			if (hMutex)
     1.9 -				CloseHandle(hMutex);
    1.10 -			else
    1.11 +			HANDLE hSemaphore = CreateSemaphore(NULL, 0, 2, _T("PEPINSTALLERSEMAPHORE"));
    1.12 +			if (GetLastError() != ERROR_SUCCESS)
    1.13  				return;
    1.14 +			else if (hSemaphore)
    1.15 +				CloseHandle(hSemaphore);
    1.16  		}
    1.17  
    1.18          BCRYPT_KEY_HANDLE dk = delivery_key();