API Reference



  • Function JOIN (task)
    Join a task, meaning stop execution of the current thread until the result of the task is available, and then return this result. When this is called on a task that no thread is currently working on, the current thread executes the task directly.
  • Function SELECT-ONE (&rest tasks)
    Returns the first task that can be joined without blocking.
  • Function DONE-P (task)
  • Function FINISH-TASKS
  • Function (setf THREAD-POOL-SIZE) (size)
  • Function SET-WORKER-ENVIRONMENT (wrapper)
  • Macro WITH-LOCAL-THREAD-POOL ((&key (size '(pool-size *pool*)) (on-unwind :wait) (worker-environment '(pool-env *pool*))) &body body)
    Run body with a fresh thread pool. If on-unwind is :wait, it will wait for all tasks to finish before returning. If it is :leave, the form will return while threads are still working. If it is :stop or :destroy, the threads will be stopped at the end of the body. With :stop, they will first finish their current task (if any), with :destroy, they will be brutally destroyed and might leak resources, leave stuff in inconsistent state, etc.
  • Function PCALL (thunk)
    Call a thunk in parallel. Returns a task that can be joined. When an exclusive is given, the task will only run when no other tasks with that exclusive are running.
  • Macro PEXEC (&body body)
    Shorthand for pcall.
  • Macro PLET ((&rest bindings) &body body)



  • Function MAKE-QUEUE
    Create an empty queue.
  • Function QUEUE-PUSH (elt queue)
    Push an element onto the back of a queue.
  • Function QUEUE-POP (queue)
    Pop an element from the front of a queue. Returns immediately, returning nil if the queue is empty, and a second value indicating whether anything was popped.
  • Function QUEUE-WAIT (queue)
    Pop an element from the front of a queue. Causes a blocking wait when no elements are available.
  • Function QUEUE-LENGTH (queue)
    Find the length of a queue.
  • Function QUEUE-EMPTY-P (queue)
    Test whether a queue is empty.