Function: make-condition-variable

make-condition-variable is a function defined in thread.c.

Signature

(make-condition-variable MUTEX &optional NAME)

Documentation

Make a condition variable associated with MUTEX.

A condition variable provides a way for a thread to sleep while waiting for a state change.

MUTEX is the mutex associated with this condition variable. NAME, if given, is the name of this condition variable. The name is informational only.

Source Code

// Defined in /usr/src/emacs/src/thread.c
{
  CHECK_MUTEX (mutex);
  if (!NILP (name))
    CHECK_STRING (name);

  struct Lisp_CondVar *condvar
    = ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_CondVar, name, PVEC_CONDVAR);
  condvar->mutex = mutex;
  condvar->name = name;
  sys_cond_init (&condvar->cond);

  Lisp_Object result;
  XSETCONDVAR (result, condvar);
  return result;
}