Mutex

Table 62: Mutex Creation Options Symbolic Constants

Constant Description
OPC_MT_MUTEX_NO_OPTIONS specifies that neither the rank nor description argument will be used for a certain mutex.
OPC_MT_MUTEX_RANK_CHECK assigns a numeric rank to a mutex. The rank is then used to detect potential deadlock situations.
OPC_MT_MUTEX_RECURSIVE allows a thread to lock a mutex multiple times without unlocking it first.
OPC_PRG_MUTEX_READER_WRITER creates a combination reader/writer mutex. This kind of mutex allows multiple readers to access the mutual exclusion area, but at most one writer. OPC_MT_MUTEX_RECURSIVE cannot be used with this symbolic constant.

Table 63: Mutex Lock Options Symbolic Constants

Constant Description
OPC_MT_MUTEX_LOCK_READER locks the mutual exclusion area in reader mode. Multiple threads can access the exclusion area simultaneously as readers, but an attempt to lock the mutex in writer mode waits until all current readers have unlocked the mutex. Use this value if the mutual exclusion area needs to be accessed (but not modified) by multiple threads.
This value is meaningful only if the mutex was created with the OPC_PRG_MUTEX_READER_WRITER option.
OPC_MT_MUTEX_LOCK_WRITER locks the mutual exclusion area in writer mode. No other threads can lock the mutex, even as readers. Use this value if the mutual exclusion area has data that will be modified.
This value is meaningful only if the mutex was created with the OPC_PRG_MUTEX_READER_WRITER option.