ctThrdMutexGet
Acquires a mutex.
Short Name
ctThrdMutexGet()
Type
Threading function
Declaration
NINT ctThrdMutexGet(pctMUTEX mutex)
Description
A mutex is the most simple, efficient synchronization object supported by this API. A mutex must be released by the same thread that acquired it. ctThrdMutexGet() waits indefinitely to acquire the mutex. Only one thread can acquire a mutex at a time. The argument to ctThrdMutexGet() is the address of a mutex object of type ctMUTEX.
Return
On error, check sysiocod for the system level error return.
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful function. |
636 |
TSYF_ERR |
mutex get failed. |
See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
ctMUTEX tfin_mtx;
NINT rc;
ctThrdMutexGet(&tfin_mtx);
rc = tfin;
ctThrdMutexRel(&tfin_mtx);
Limitations
Can only be used with a ctThrd library.
See also
ctThrdMutexTry, ctThrdMutexRel