Function: condition-notify

condition-notify is a function defined in thread.c.

Signature

(condition-notify COND &optional ALL)

Documentation

Notify COND, a condition variable.

This wakes a thread waiting on COND. If ALL is non-nil, all waiting threads are awoken.

The mutex associated with COND must be held when this is called. It is an error if it is not held.

This releases COND's mutex when notifying COND. When condition-notify returns, the mutex will again be locked by this thread.

View in manual

Source Code

// Defined in /usr/src/emacs/src/thread.c
{
  struct Lisp_CondVar *cvar;
  struct Lisp_Mutex *mutex;
  struct notify_args args;

  CHECK_CONDVAR (cond);
  cvar = XCONDVAR (cond);

  mutex = XMUTEX (cvar->mutex);
  if (!lisp_mutex_owned_p (&mutex->mutex))
    error ("Condition variable's mutex is not held by current thread");

  args.cvar = cvar;
  args.all = !NILP (all);
  flush_stack_call_func (condition_notify_callback, &args);

  return Qnil;
}