4.10.7 mtx
Keywords: onyx

Next: 4.10.8 nx Up: 4.10 Classes Previous: 4.10.6 mq Contents Index
Subsections

- 4.10.7.1 API

##
4.10.7 mtx

The mtx class implements typical mutual exclusion locks. Only one thread can hold a lock at a time, and attempting to attain the lock while already owning it has undefined results.

### 4.10.7.1 API

void mtx_new(cw_mtx_t *a_mtx):

  Input(s):
    a_mtx:
      Pointer to space for a mtx.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Constructor.

void mtx_delete(cw_mtx_t *a_mtx):

  Input(s):
    a_mtx:
      Pointer to a mtx.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Destructor.

void mtx_lock(cw_mtx_t *a_mtx):

  Input(s):
    a_mtx:
      Pointer to a mtx.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Lock a_mtx.

bool mtx_trylock(cw_mtx_t *a_mtx):

  Input(s):
    a_mtx:
      Pointer to a mtx.
  Output(s):
    retval:
      false:
        Success.
      true:
        Failure.
  Exception(s):
    None.
  Description:
    Try to lock a_mtx, but return immediately instead of blocking if a_mtx is already locked.

void mtx_unlock(cw_mtx_t *a_mtx):

  Input(s):
    a_mtx:
      Pointer to a mtx.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Unlock a_mtx.

Next: 4.10.8 nx Up: 4.10 Classes Previous: 4.10.6 mq Contents Index