Next: 4.10.3 dch Up: 4.10 Classes Previous: 4.10.1 ch Contents Index
Subsections

- 4.10.2.1 API

##
4.10.2 cnd

The cnd class implements condition variables, which can be used in conjunction with the mtx class to wait for a condition to occur.

### 4.10.2.1 API

void cnd_new(cw_cnd_t *a_cnd):

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

void cnd_delete(cw_cnd_t *a_cnd):

  Input(s):
    a_cnd:
      Pointer to a cnd.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Destructor.

void cnd_signal(cw_cnd_t *a_cnd):

  Input(s):
    a_cnd:
      Pointer to a cnd.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Signal one thread waiting on a_cnd, if there are any waiters.

void cnd_broadcast(cw_cnd_t *a_cnd):

  Input(s):
    a_cnd:
      Pointer to a cnd.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Signal all threads waiting on a_cnd.

bool cnd_timedwait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx, const struct timespec *a_timeout):

  Input(s):
    a_cnd:
      Pointer to a cnd.
    a_mtx:
      Pointer to a mtx.
    a_timeout:
      Timeout, specified as an absolute time interval.
  Output(s):
    retval:
      false:
        Success.
      true:
        Timeout.
  Exception(s):
    None.
  Description:
    Wait for a_cnd for at least a_time.

void cnd_wait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx):

  Input(s):
    a_cnd:
      Pointer to a cnd.
    a_mtx:
      Pointer to a mtx.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Wait for a_cnd.

Next: 4.10.3 dch Up: 4.10 Classes Previous: 4.10.1 ch Contents Index