xHarbour Reference Documentation > Function Reference |
Obtains a permanent lock on a Mutex.
HB_MutexLock( <pMutexHandle> ) --> lSuccess
The function returns .T. (true) when the Mutex is locked, and .F. (false) when an error occurs.
Function HB_MutexLock() locks the Mutex <pMutexHandle> for the current thread. If the Mutex is already locked by another thread, the current thread is suspended. That is, HB_MutexLock() waits infinitely and returns only when a lock is obtained.
If the infinite wait period is not desired, a thread can call HB_MutexTryLock() to check if the Mutex can be locked, or HB_MutexTimeoutLock(), to restrict the wait period to a specified amount of time.
A locked Mutex must be unlocked with HB_MutexUnlock() to grant other threads access to the Mutex protected program code.
Refer to function HB_MutexCreate() for more information on Mutexes.
See also: | GetCurrentThread(), GetThreadID(), HB_MutexCreate(), HB_MutexTimeoutLock(), HB_MutexTryLock(), HB_MutexUnlock(), JoinThread(), Notify(), StartThread(), Subscribe() |
Category: | Multi-threading functions , Mutex functions , xHarbour extensions |
Source: | vm\thread.c |
LIB: | xhbmt.lib |
DLL: | xhbmtdll.dll |
http://www.xHarbour.com