libzrtp  1.2.0
ZRTP VoIP security
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Synchronization related functions
Library Interfaces Overview

Functions

zrtp_status_t zrtp_mutex_init (zrtp_mutex_t **mutex)
 Initializing the mutex structure.
 
zrtp_status_t zrtp_mutex_destroy (zrtp_mutex_t *mutex)
 Deinitializing the mutex structure.
 
zrtp_status_t zrtp_mutex_lock (zrtp_mutex_t *mutex)
 Mutex locking.
 
zrtp_status_t zrtp_mutex_unlock (zrtp_mutex_t *mutex)
 Mutex releasing.
 

Detailed Description

Function Documentation

zrtp_status_t zrtp_mutex_destroy ( zrtp_mutex_t *  mutex)

Deinitializing the mutex structure.

This function destroys the mutex object previously allocated by zrtp_mutex_init().

Parameters
mutex- mutex structure for deinitialization.
Returns
:
  • zrtp_status_ok if deinitialization successful;
  • zrtp_status_fail if an error occurred.
See Also
zrtp_mutex_init()
zrtp_status_t zrtp_mutex_init ( zrtp_mutex_t **  mutex)

Initializing the mutex structure.

This function allocates and initializes the mutex referenced by mutex with default attributes. Upon successful initialization, the state of the mutex becomes initialized and unlocked. This function should create a NON RECURSIVE mutex. (Attempting to relock the mutex causes deadlock)

Parameters
mutex- out parameter, mutex structure for allocation and initialization
Returns
:
  • zrtp_status_ok if initialization successful;
  • zrtp_status_fail if an error occurred.
See Also
zrtp_mutex_destroy()
zrtp_status_t zrtp_mutex_lock ( zrtp_mutex_t *  mutex)

Mutex locking.

This function locks the mutex object referenced by mutex. If the mutex is already locked, the thread that called it is blocked until the mutex becomes available. This operation returns the mutex object referenced by the mutex in the locked state with the calling thread as its owner.

Parameters
mutex- mutex for locking;
Returns
:
  • zrtp_status_ok if successful;
  • zrtp_status_fail if an error occurred.
zrtp_status_t zrtp_mutex_unlock ( zrtp_mutex_t *  mutex)

Mutex releasing.

This function releases the mutex object referenced by mutex. The way a mutex is released depends on the mutex's type attribute. If there are threads blocked on the mutex object referenced by mutex when zrtp_mutex_unlock() is called and the mutex becomes available, the scheduling policy determines which thread acquires the mutex.

Parameters
mutex- mutex to release
Returns
:
  • zrtp_status_ok if successful;
  • zrtp_status_fail if an error occurred.