| Maestro Audio Framework v 1.0 NXP Semiconductors

Functions
osa_cond.h File Reference

Contains condition variable (CV) function prototypes. More...

## Functions
int | osa_cond_create (OsaCondition *cond)
| Create CV object. More...
int | osa_cond_destroy (OsaCondition *cond)
| Destroy CV object. More...
int | osa_cond_wait (OsaCondition *cond, OsaMutex *mutex, uint32_t msec_timeout)
| Wait on a condition. More...
int | osa_cond_signal (OsaCondition *cond)
| Signal a condition. More...
int | osa_cond_broadcast (OsaCondition *cond)
| Broadcast a condition. More...

## Function Documentation

## ◆ osa_cond_create()

int osa_cond_create | ( | OsaCondition * | cond | ) |

Create and return a new condition variable object

Parameters

  cond | A condition object that will be allocated and initialized. It is returned to the call on success.

Return values

  ERRCODE_NO_ERROR | Function succeeded
  ERRCODE_OUT_OF_MEMORY | Out of memory
  ERRCODE_BUSY | Attempting to reinitialize an existing CV
  ERRCODE_GENERAL_ERROR | Unexpected system error

## ◆ osa_cond_destroy()

int osa_cond_destroy | ( | OsaCondition * | cond | ) |

Free the resources for a condition variable object

Parameters

  cond | A valid condition object

Return values

  ERRCODE_NO_ERROR | Function succeeded
  ERRCODE_BUSY | Attempting to reinitialize an existing CV
  ERRCODE_GENERAL_ERROR | Unexpected system error

## ◆ osa_cond_wait()

int osa_cond_wait | ( | OsaCondition * | cond,
|  | OsaMutex * | mutex,
|  | uint32_t | msec_timeout
| ) |  |

Release the mutex and wait on the condition argument. The mutex is reacquired before the function returns.

Parameters

  cond | A valid condition object
  mutex | A valid mutex object that the caller holds a lock on
  msec_timeout | Optional timeout. If zero, the wait will block forever. Any other value will cause the wait to abort after the specified number of milliseconds.

Return values

  ERRCODE_NO_ERROR | Function succeeded
  ERRCODE_OUT_OF_MEMORY | Out of memory
  ERRCODE_INVALID_ARGUMENT | Invalid condition parameter
  ERRCODE_PERMISSION_DENIED | Mutex not owned by the calling thread
  ERRCODE_GENERAL_ERROR | Unexpected system error

## ◆ osa_cond_signal()

int osa_cond_signal | ( | OsaCondition * | cond | ) |

Unblock one thread waiting for the condition argument

Parameters

  cond | A valid condition object

Return values

  ERRCODE_NO_ERROR | Function succeeded
  ERRCODE_OUT_OF_MEMORY | Out of memory
  ERRCODE_INVALID_ARGUMENT | Invalid condition parameter
  ERRCODE_GENERAL_ERROR | Unexpected system error

## ◆ osa_cond_broadcast()

int osa_cond_broadcast | ( | OsaCondition * | cond | ) |

Unblock all threads waiting for the condition argument

Parameters

  cond | A valid condition object

Warning
  On MQX this does the same as osa_cond_signal

Return values

  ERRCODE_NO_ERROR | Function succeeded
  ERRCODE_OUT_OF_MEMORY | Out of memory
  ERRCODE_INVALID_ARGUMENT | Invalid condition parameter
  ERRCODE_GENERAL_ERROR | Unexpected system error