chanl

API Reference

chanl

Communicating Sequential Process support for Common Lisp

TRIVIAL-COMPARE-AND-SWAP

  • Macro ATOMIC-INCF (place &optional (delta 1))

Also exports

  • SB-EXT:COMPARE-AND-SWAP

CHANL

  • Class TASK
    NAME   Accessor: TASK-NAME
    FUNCTION   Reader: TASK-FUNCTION
    STATUS   Accessor: TASK-STATUS
    THREAD   Accessor: TASK-THREAD
  • Function POOLED-THREADS
  • Function POOLED-TASKS
  • Function CURRENT-THREAD
  • Function THREAD-ALIVE-P (proc)
  • Function THREADP (proc)
  • Function THREAD-NAME (proc)
  • Function KILL (proc)
  • Function ALL-THREADS
  • Function PCALL (function &key (initial-bindings *default-special-bindings*) (name "anonymous task"))
    PCALL -> Parallel Call; calls FUNCTION in a new thread. FUNCTION must be a no-argument function. INITIAL-BINDINGS, if provided, should be an alist representing dynamic variable bindings that BODY is to be executed with. The format is: '((*var* value)).
  • Macro PEXEC ((&key initial-bindings name) &body body)
    Executes BODY in parallel. INITIAL-BINDINGS, if provided, should be an alist representing dynamic variable bindings that BODY is to be executed with. The format is: '((*var* value)).
  • Class ABSTRACT-CHANNEL
    No slots.
  • Generic-Function CHANNELP (channel)
  • Method CHANNELP ((anything-else t))
  • Method CHANNELP ((anything-else t))
  • Method CHANNELP ((anything-else t))
  • Generic-Function SEND (chan value &key)
    Tries to send VALUE into CHAN. If a sequence of channels is provided instead of a single channel, SEND will send the value into the first channel that doesn't block. If BLOCKP is true, SEND will continue to block until it's able to actually send a value. If BLOCKP is NIL, SEND will immediately return NIL instead of blocking, if there's no channel available to send input into. When SEND succeeds, it returns the channel the value was sent into.
  • Method SEND ((channels sequence) value &key (blockp t))
  • Method SEND ((channels sequence) value &key (blockp t))
  • Method SEND ((channels sequence) value &key (blockp t))
  • Method SEND ((channels null) (value t) &key)
  • Method SEND ((channels null) (value t) &key)
  • Method SEND ((channels null) (value t) &key)
  • Generic-Function RECV (chan &key)
    Tries to receive from either a single channel, or a sequence of channels. If BLOCKP is true, RECV will block until it's possible to receive something. Returns two values: The first is the actual value received through the channel. The second is the channel the value was received from. When BLOCKP is NIL, RECV will immediately return (values NIL NIL) instead of blocking (if it would block)
  • Method RECV ((channels sequence) &key (blockp t))
  • Method RECV ((channels sequence) &key (blockp t))
  • Method RECV ((channels sequence) &key (blockp t))
  • Method RECV ((channels null) &key)
  • Method RECV ((channels null) &key)
  • Method RECV ((channels null) &key)
  • Class CHANNEL  (ABSTRACT-CHANNEL)
    VALUE   Accessor: CHANNEL-VALUE
    READERS   Accessor: CHANNEL-READERS
    WRITERS   Accessor: CHANNEL-WRITERS
    LOCK   Accessor: CHANNEL-LOCK
    SEND-OK   Accessor: CHANNEL-SEND-OK
    RECV-OK   Accessor: CHANNEL-RECV-OK
    SEND-RETURN-WAIT   Accessor: CHANNEL-SEND-RETURN-WAIT
    RECV-GRABBED-VALUE-P   Accessor: RECV-GRABBED-VALUE-P
  • Method SEND ((channel channel) value &key (blockp t))
  • Generic-Function CHANNEL-INSERT-VALUE (channel value)
  • Method CHANNEL-INSERT-VALUE ((channel channel) value)
  • Method CHANNEL-INSERT-VALUE ((channel channel) value)
  • Method CHANNEL-INSERT-VALUE ((channel channel) value)
  • Generic-Function SEND-BLOCKS-P (channel)
    Returns T if trying to SEND to CHANNEL would block. Note that this is not an atomic operation, and should not be relied on in production. It's mostly meant for interactive/debugging purposes.
  • Method SEND-BLOCKS-P ((channel channel))
  • Method SEND-BLOCKS-P ((channel channel))
  • Method SEND-BLOCKS-P ((channel channel))
  • Method RECV ((channel channel) &key (blockp t))
  • Generic-Function RECV-BLOCKS-P (channel)
  • Method RECV-BLOCKS-P ((channel channel))
  • Method RECV-BLOCKS-P ((channel channel))
  • Method RECV-BLOCKS-P ((channel channel))
  • Generic-Function CHANNEL-GRAB-VALUE (channel)
  • Method CHANNEL-GRAB-VALUE ((channel channel))
  • Method CHANNEL-GRAB-VALUE ((channel channel))
  • Method CHANNEL-GRAB-VALUE ((channel channel))
  • Class BUFFERED-CHANNEL  (CHANNEL)
    Abstract class for channels using various buffering styles.
    No slots.
  • Class STACK-CHANNEL  (BUFFERED-CHANNEL)
    No slots.
  • Method CHANNEL-INSERT-VALUE ((channel stack-channel) value)
  • Method CHANNEL-GRAB-VALUE ((channel stack-channel))
  • Method SEND-BLOCKS-P ((channel stack-channel))
  • Method RECV-BLOCKS-P ((channel stack-channel))
  • Class QUEUE-CHANNEL  (BUFFERED-CHANNEL)
    These channels buffer objects in some sort of queue.
    No slots.
  • Method CHANNEL-INSERT-VALUE ((channel queue-channel) value)
  • Method CHANNEL-GRAB-VALUE ((channel queue-channel))
  • Variable +MAXIMUM-BUFFER-SIZE+
    (- array-total-size-limit 2)
    The exclusive upper bound on the size of a channel's buffer.
  • Class BOUNDED-CHANNEL  (QUEUE-CHANNEL)
    No slots.
  • Method SEND-BLOCKS-P ((channel bounded-channel))
  • Method RECV-BLOCKS-P ((channel bounded-channel))
  • Class UNBOUNDED-CHANNEL  (QUEUE-CHANNEL)
    No slots.
  • Method SEND-BLOCKS-P ((channel unbounded-channel))
  • Method RECV-BLOCKS-P ((channel unbounded-channel))
  • Class CAS-CHANNEL  (ABSTRACT-CHANNEL)
    These channels use COMPARE-AND-SWAP to do their thing, instead of locks+condition-vars. Ideally, these would be faster than regular channels. In reality, they're not. It's possible there might be a way to speed these guys up while keeping the same behavior in the interface, but for now, they're about 100x slower, not to mention non-portable.
    VECTOR   Accessor: CHANNEL-VECTOR
  • Method SEND ((channel cas-channel) value &key (blockp t))
  • Method SEND-BLOCKS-P ((channel cas-channel))
  • Method CHANNEL-INSERT-VALUE ((channel cas-channel) value)
  • Method RECV ((channel cas-channel) &key (blockp t))
  • Method RECV-BLOCKS-P ((channel cas-channel))
  • Method CHANNEL-GRAB-VALUE ((channel cas-channel))
  • Macro SELECT (&body clauses)
    Non-deterministically select a non-blocking clause to execute. The syntax is: select clause* clause ::= (op form*) op ::= (recv c &optional variable channel-var) | (send c value &optional channel-var) | else | otherwise | t c ::= An evaluated form representing a channel, or a sequence of channels. variable ::= an unevaluated symbol RECV's return value is to be bound to. Made available to form*. value ::= An evaluated form representing a value to send into the channel. channel-var ::= An unevaluated symbol that will be bound to the channel the SEND/RECV operation succeeded on. SELECT will first attempt to find a clause with a non-blocking op, and execute it. Execution of the check-if-blocks-and-do-it part is atomic, but execution of the clause's body once the SEND/RECV clause executes is NOT atomic. If all channel clauses would block, and no else clause is provided, SELECT will thrash-idle (an undesirable state!) until one of the clauses is available for execution. SELECT's non-determinism is, in fact, very non-deterministic. Clauses are chosen at random, not in the order they are written. It's worth noting that SEND/RECV, when used on sequences of channels, are still linear in the way they go through the sequence -- the random selection is reserved for individual SELECT clauses.

Also exports

  • BORDEAUX-THREADS:*DEFAULT-SPECIAL-BINDINGS*

CHANL.ACTORS

  • Variable *BOSS*
    nil
  • Class ACTOR
    NAME   Reader: NAME
    Name for identifying this actor and its tasks
    ABBREV
    STATE
    Represents/performs actor's state
    TUBES
    Channels used for communication
    BOSS   Reader: BOSS
    For whom['s benefit] the bell tolls
    COMMAND
    Command being executed by the actor
  • Function SLOT-CHANNEL (actor slot)
    Returns the channel associated with `slot' in `actor'
  • Generic-Function COMPUTE-TUBES (actor)
    Calculates the list of communication slots for `actor'. Methods should return a list of specifications (or a single one as an atom)
  • Method COMPUTE-TUBES ((actor actor))
  • Method COMPUTE-TUBES ((actor actor))
  • Method COMPUTE-TUBES ((actor actor))
  • Method COMPUTE-TUBES ((actor actor))
    Combines the specifications, creating channels if necessary
  • Method COMPUTE-TUBES ((actor actor))
    Combines the specifications, creating channels if necessary
  • Method COMPUTE-TUBES ((actor actor))
    Combines the specifications, creating channels if necessary
  • Generic-Function CHRISTEN (actor)
  • Method CHRISTEN ((actor actor))
  • Method CHRISTEN ((actor actor))
  • Method CHRISTEN ((actor actor))
  • Method CHRISTEN ((actor actor))
  • Method CHRISTEN ((actor actor))
  • Method CHRISTEN ((actor actor))
  • Generic-Function PERFORM (actor)
    Implement actor's behavior, executing commands by default
  • Method PERFORM ((actor actor))
  • Method PERFORM ((actor actor))
  • Method PERFORM ((actor actor))
  • Generic-Function EXECUTE (actor command)
  • Method EXECUTE ((actor actor) (command (eql :die)))
  • Method EXECUTE ((actor actor) (command (eql :die)))
  • Method EXECUTE ((actor actor) (command (eql :die)))
  • Method EXECUTE ((actor actor) (command function))
  • Method EXECUTE ((actor actor) (command function))
  • Method EXECUTE ((actor actor) (command function))
  • Generic-Function ENSURE-RUNNING (actor)
  • Method ENSURE-RUNNING ((actor actor))
  • Method ENSURE-RUNNING ((actor actor))
  • Method ENSURE-RUNNING ((actor actor))
  • Class BOSS  (ACTOR)
    WORKERS
    Workers managed by this boss
    TO-RUN
    New actor to manage
    TO-HALT
    Actor to halt, but keep its link
    TO-FIRE
    Actor to both halt and unlink
  • Method COMPUTE-TUBES ((boss boss))
  • Method ENSURE-RUNNING ((boss boss))
  • Method EXECUTE ((boss boss) (command (eql :die)))
  • Function HALT (actor)
  • Function FIRE (actor)
  • Method PERFORM ((boss boss))
  • Method PERFORM ((boss boss))
  • Method PERFORM ((boss boss))