(mutual exception), (mutex), CRITICAL_SECTION. , , . , , , .
CS, , , , , (abandoned) , .[29] ( (block) ) (WaitForSingleObject WaitForMultipleObjects) ReleaseMutex.
, , , . , , . , , . , CS, , , (nested transactions).
CreateMutex, ReleaseMutex OpenMutex.
HANDLE CreateMutex(LPSECURITY_ATTRIBUTES lpsa, BOOL bInitialOwner, LPCTSTR lpMutexName)
BOOL ReleaseMutex(HANDLE hMutex)
bInitialOwner True, . , , . (initial owner ), , .
lpMutexName , ; . NULL, . , , , , , , . . 260 .
HANDLE; NULL .
OpenMutex . , . , , , . OpenMutex CreateMutex . , ( 5), Create Open. , , , Create , Open, , . , Create , .
|
|
ReleaseMutex , . , .
BOOL ReleaseMutex(HANDLE hMutex)
POSIX Pthreads . :
pthread_mutex_init
pthread_mutex_destroy
pthread_mutex_lock
pthread_mutex_unlock
pthread_mutex_lock WaitForSingleObject . pthread_mutex_trylock , WaitForSingleObject . Pthreads , Windows- CRITICAL_SECTION.