Merge pull request #1161 from bmiklautz/mutex_init
winpr/mutex: Support for bInitialOwner in CreateMutex
This commit is contained in:
commit
f778cd38c3
@ -39,15 +39,18 @@
|
|||||||
|
|
||||||
HANDLE CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName)
|
HANDLE CreateMutexW(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName)
|
||||||
{
|
{
|
||||||
HANDLE handle;
|
HANDLE handle = NULL;
|
||||||
pthread_mutex_t* pMutex;
|
pthread_mutex_t* pMutex;
|
||||||
|
|
||||||
pMutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
|
pMutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
|
||||||
|
|
||||||
if (pMutex)
|
if (pMutex)
|
||||||
|
{
|
||||||
pthread_mutex_init(pMutex, 0);
|
pthread_mutex_init(pMutex, 0);
|
||||||
|
handle = winpr_Handle_Insert(HANDLE_TYPE_MUTEX, pMutex);
|
||||||
handle = winpr_Handle_Insert(HANDLE_TYPE_MUTEX, pMutex);
|
if (bInitialOwner)
|
||||||
|
pthread_mutex_lock(pMutex);
|
||||||
|
}
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user