threadpPortable Threadswith-lock-heldthread-holds-lock-pGoTo Top

thread-holds-lock-p   lock => boolean[Function]

Purpose
Determine if lock is held by the current thread.

Package   :portable-threads

Module   :portable-threads

Arguments and values

lock     A lock, a recursive lock, or a condition variable
boolean     A generalized boolean

Returns
True if the current thread holds lock; nil otherwise.

See also
    make-condition-variable
    make-lock
    make-recursive-lock
    with-lock-held
    without-lock-held

Examples
Two simple examples using a lock:

  > (thread-holds-lock-p lock)
  nil
  > (with-lock-held (lock)
      (thread-holds-lock-p lock))
  t
  >
Two more simple examples using a condition variable:
  > (thread-holds-lock-p condition-variable)
  nil
  > (with-lock-held (condition-variable)
      (thread-holds-lock-p condition-variable))
  t
  >


The GBBopen Project


threadpPortable Threadswith-lock-heldthread-holds-lock-pGoTo Top