green-threads

API Reference

green-threads

A lightweight threading / cooperative multitasking library.

GREEN-THREADS

  • Variable *DEFAULT-SPECIAL-BINDINGS*
    nil
  • Function QUEUE-NEXT (action &optional thread)
  • Function MAKE-THREAD (function &key name)
    Create a new green thread with an optional :name. The first parameter should be a function that takes no arguments. The thread will be queued immediately, so will run immediately if make-thread is called from outside any other green threads. Returns a thread object.
  • Macro WITH-GREEN-THREAD (&body body)
    A convenience macro that runs the code in a lambda wrapped in CPS transformin macros and a call to make-thread. Returns thread object.
  • Function ALL-THREADS
    Returns a list of all active threads, which are threads that have been created but not destroyed or finished.
  • Function CURRENT-THREAD
    Returns the currently running greed thread or NIL if not called from within thread.
  • Function THREADP (obj)
    Returns T if the object passed in is a thread.
  • Function THREAD-NAME (thread)
    Returns the name of the thread given at the time of creation or NIL.
  • Function DESTROY-THREAD (thread)
    Destroys the thread passed in, so it will not run any more. It is an error to call this on the current thread.
  • Function THREAD-ALIVE-P (thread)
    Returns T if the passed in thread has not been destroyed.
  • Function GET-JOIN-FUTURE (thread)
    Gets a future object from thread which will be completed when the thread is finished.
  • Function QUEUE-FUTURE (future action &optional thread)
    Queues an action on current (or specified) thread to take place when provided future is completed.
  • Function FUTURE-VALUES (future)
    Returns the values given to the future when it was completed.
  • Generic-Function SEND (channel value continuation &key)
  • Generic-Function RECV (channel continuation &key)
  • Class CHANNEL
    WAITING-TO-SEND
    WAITING-TO-RECV
  • Method SEND ((channel channel) value continuation &key (blockp t))
  • Method RECV ((channel channel) continuation &key (blockp t))

Also exports

  • CL-ASYNC-FUTURE:MAKE-FUTURE
  • BLACKBIRD-BASE:FINISH
  • CL-ASYNC-FUTURE:FUTURE-FINISHED-P