Update WinUtil
This commit is contained in:
parent
3323a8bdb5
commit
b4799c6b61
23
WinUtil.cpp
23
WinUtil.cpp
@ -72,14 +72,29 @@ DWORD NamedMutex::getError() const
|
||||
return errcode;
|
||||
}
|
||||
|
||||
void NamedMutex::wait()
|
||||
int NamedMutex::wait()
|
||||
{
|
||||
WaitForSingleObject(hmtx,INFINITE);
|
||||
return wait_for(INFINITE);
|
||||
}
|
||||
|
||||
void NamedMutex::wait_for(int ms)
|
||||
int NamedMutex::wait_for(int ms)
|
||||
{
|
||||
WaitForSingleObject(hmtx,ms);
|
||||
DWORD ret=WaitForSingleObject(hmtx,ms);
|
||||
if(ret==WAIT_OBJECT_0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if(ret==WAIT_TIMEOUT)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// WAIT_ABANDONED
|
||||
// WAIT_FAILED
|
||||
errcode=GetLastError();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void NamedMutex::release()
|
||||
|
Loading…
x
Reference in New Issue
Block a user