High Performance OPC UA Server SDK  1.1.0.158

Mutex that can be locked and unlocked for mutual exclusion of different processes. More...

Enumerations

enum  ua_mutex_mode { UA_MUTEX_DEFAULT = 0, UA_MUTEX_SHARED = 1 }
 Mode for a newly created mutex. More...
 

Functions

int ua_mutex_init (ua_mutex_t *mutex, int mode) UA_NONNULL(1)
 Initialize a mutex in a given mode. More...
 
int ua_mutex_clear (ua_mutex_t *mutex) UA_NONNULL(1)
 Clear a mutex. More...
 
int ua_mutex_lock (ua_mutex_t *mutex) UA_NONNULL(1)
 Lock a mutex. More...
 
int ua_mutex_unlock (ua_mutex_t *mutex) UA_NONNULL(1)
 Unlock a mutex. More...
 

Detailed Description

Mutex that can be locked and unlocked for mutual exclusion of different processes.

Enumeration Type Documentation

Mode for a newly created mutex.

See also
ua_mutex_init
Enumerator
UA_MUTEX_DEFAULT 

Default: shared or private is platform specific.

UA_MUTEX_SHARED 

Mutex can be shared by multiple processes.

Function Documentation

int ua_mutex_clear ( ua_mutex_t *  mutex)

Clear a mutex.

the mutex may no longer be locked or unlocked.

Parameters
mutexMutex to clear.
Returns
Zero on success or non-zero value on failure.
int ua_mutex_init ( ua_mutex_t *  mutex,
int  mode 
)

Initialize a mutex in a given mode.

The state of the mutex after initialization is unlocked.

Parameters
mutexMutex structure to initialize.
modeMode of the mutex, see ua_mutex_mode.
Returns
Zero on success or non-zero value on failure.
int ua_mutex_lock ( ua_mutex_t *  mutex)

Lock a mutex.

If the mutex is already locked the calling process shall be blocked until the mutex is unlocked.

Parameters
mutexMutex to lock.
Returns
Zero on success or non-zero value on failure.
int ua_mutex_unlock ( ua_mutex_t *  mutex)

Unlock a mutex.

The mutex shall only be unlocked by the process that locked it. Only a locked mutex shall be unlocked.

Parameters
mutexMutex to unlock.
Returns
Zero on success or non-zero value on failure.