cl-stm

API Reference

cl-stm

Software Transactional Memory

CL-STM

  • Class TRANSACTION
    No slots.
  • Generic-Function PERFORM (transaction &key wait?)
    Run TRANSACTION atomically with respect to all other threads in a new thread. If the transaction retries, then the thread loops again re-executing the transaction and commiting it to memory. When WAIT? is true, then PERFORM returns the result of executing TRANSACTION. Otherwise PERFORM returns a thread created by BORDEAUX-THREADS as its value.
  • Generic-Function PERFORM (transaction &key wait?)
    Run TRANSACTION atomically with respect to all other threads in a new thread. If the transaction retries, then the thread loops again re-executing the transaction and commiting it to memory. When WAIT? is true, then PERFORM returns the result of executing TRANSACTION. Otherwise PERFORM returns a thread created by BORDEAUX-THREADS as its value.
  • Generic-Function EXECUTE (transaction)
    Execute TRANSACTION and return 3 values. 1. A boolean specifying whether or not the transaction retried. 2. A transaction log of all the changes that occured. 3. A list of values that TRANSACTION returns.
  • Generic-Function EXECUTE (transaction)
    Execute TRANSACTION and return 3 values. 1. A boolean specifying whether or not the transaction retried. 2. A transaction log of all the changes that occured. 3. A list of values that TRANSACTION returns.
  • Generic-Function ORELSE (tx1 tx2)
    Compose two transactions alternatively. ORELSE returns a new transaction. We perform TX1 and if it succeeds then we're done. If it fails then we perform TX2. If performing TX2 succeeds then we're done. If it fails we try to perform TX1 again, and so on. The transaction's return value (not ORELSE's) is nondeterministic because we can't tell in advance which transaction succeeds. ORELSE is just the plumbing behind the TRY macro, which is just a variable arity version of ORELSE.
  • Generic-Function ORELSE (tx1 tx2)
    Compose two transactions alternatively. ORELSE returns a new transaction. We perform TX1 and if it succeeds then we're done. If it fails then we perform TX2. If performing TX2 succeeds then we're done. If it fails we try to perform TX1 again, and so on. The transaction's return value (not ORELSE's) is nondeterministic because we can't tell in advance which transaction succeeds. ORELSE is just the plumbing behind the TRY macro, which is just a variable arity version of ORELSE.
  • Class TLOG
    A transaction log (TLOG) is a record of what reads and writes have been done. Transaction logs are written during the execution of a transaction (using READ-TVAR and WRITE-TVAR). Transactions logs are committed to memory by COMMIT later on.
    No slots.
  • Generic-Function COMMIT (log)
    Commit a LOG to memory. It returns a boolean specifying whether or not the transaction log was committed. If the transaction log couldn't be committed it probably means that another transaction log that writes the same variables is being committed.
  • Generic-Function COMMIT (log)
    Commit a LOG to memory. It returns a boolean specifying whether or not the transaction log was committed. If the transaction log couldn't be committed it probably means that another transaction log that writes the same variables is being committed.
  • Generic-Function CHECK? (log)
    Check that LOG is consistent. It returns a boolean specifying whether or not LOG is valid with respect to the current Common Lisp world. CHECK can be used to see if a transaction isn't consistent before committing it.
  • Generic-Function CHECK? (log)
    Check that LOG is consistent. It returns a boolean specifying whether or not LOG is valid with respect to the current Common Lisp world. CHECK can be used to see if a transaction isn't consistent before committing it.
  • Generic-Function MERGE-LOGS (log1 log2)
    Merge LOG1 and LOG2. Any reads and writes in LOG2 shadow the reads and writes in LOG1.
  • Generic-Function MERGE-LOGS (log1 log2)
    Merge LOG1 and LOG2. Any reads and writes in LOG2 shadow the reads and writes in LOG1.
  • Generic-Function WAIT (log)
    WAIT causes the current thread to wait for a change in any of LOG's reads and writes.
  • Generic-Function WAIT (log)
    WAIT causes the current thread to wait for a change in any of LOG's reads and writes.
  • Class TVAR
    A transactional variable (TVAR) holds a value. See READ-TVAR and WRITE-TVAR for reading and writing them.
    No slots.
  • Generic-Function READ-TVAR (var log)
    Record the reading of VAR to LOG. READ-TVAR is only called when transactions are being recorded, and LOG is normally the special variable *LOG*. READ-TVAR is just the plumbing behind taking the SLOT-VALUE of a transactional slot. Just use readers and accessors as you normally would on transactional objects.
  • Generic-Function READ-TVAR (var log)
    Record the reading of VAR to LOG. READ-TVAR is only called when transactions are being recorded, and LOG is normally the special variable *LOG*. READ-TVAR is just the plumbing behind taking the SLOT-VALUE of a transactional slot. Just use readers and accessors as you normally would on transactional objects.
  • Generic-Function WRITE-TVAR (var log val)
    Record the writing of VAL to VAR to LOG. WRITE-TVAR is only called when transactions are being recorded, and LOG is normally the special variable *LOG*. WRITE-TVAR is just the plumbing behind SETF'ing a transactional slot. Just use SETF as you normally would on transactional objects.
  • Generic-Function WRITE-TVAR (var log val)
    Record the writing of VAL to VAR to LOG. WRITE-TVAR is only called when transactions are being recorded, and LOG is normally the special variable *LOG*. WRITE-TVAR is just the plumbing behind SETF'ing a transactional slot. Just use SETF as you normally would on transactional objects.
  • Generic-Function UNWAIT (var)
    UNWAIT causes all threads waiting for VAR to change to wake up.
  • Generic-Function UNWAIT (var)
    UNWAIT causes all threads waiting for VAR to change to wake up.
  • Function RECORDING?
  • Macro WITH-RECORDING (&body body)
    Turn recording of reads and writes on. Recording is normally on inside transactions.
  • Macro WITHOUT-RECORDING (&body body)
    Turn recording of reads and writes off. Recording is normally off outside transactions (ie at the REPL) and when initializing transactional objects.
  • Function CURRENT-TLOG
  • Macro WITH-TLOG (log &body body)
    Execute BODY with the default transasction log being LOG.
  • Macro WITH-NEW-TLOG (var &body body)
    Execute BODY with the default transaction log being a newly allocated transaction log bound to VAR.
  • Class STANDARD-TLOG  (TLOG)
    READS   Accessor: READS-OF
    Mapping reads done to versions
    WRITES   Accessor: WRITES-OF
    Mapping variables written to new values
    SEMAPHORE   Accessor: SEMAPHORE-OF
  • Method COMMIT ((log standard-tlog))
  • Method CHECK? ((log standard-tlog))
  • Method WAIT ((log standard-tlog))
  • Method UNWAIT ((log standard-tlog))
  • Class STANDARD-TVAR  (TVAR)
    LOCK   Accessor: LOCK-OF
    VALUE   Accessor: VALUE-OF
    VERSION   Accessor: VERSION-OF
    WAITING   Accessor: WAITING-FOR
    WAITING-LOCK   Accessor: WAITING-LOCK-OF
  • Method READ-TVAR ((var standard-tvar) (log standard-tlog))
  • Method WRITE-TVAR ((var standard-tvar) (log standard-tlog) val)
  • Method UNWAIT ((var standard-tvar))
  • Class STANDARD-TRANSACTION  (TRANSACTION)
    THUNK   Accessor: THUNK-OF
    ID   Accessor: ID-OF
  • Method PERFORM ((tx standard-transaction) &key wait?)
  • Method EXECUTE ((tx standard-transaction))
  • Method ORELSE ((tx1 standard-transaction) (tx2 standard-transaction))
  • Class TRANSACTIONAL-CLASS  (STANDARD-CLASS)
    The metaclass for transactional classes. Classes defined with this metaclass have extra slot options, see the class TRANSACTIONAL-DIRECT-SLOT for details.
    No slots.
  • Class TRANSACTIONAL-DIRECT-SLOT  (STANDARD-DIRECT-SLOT-DEFINITION)
    The class for direct slots of transactional classes. Other than the initargs for standard slots the following options can be passed to component slots: :transactional [ T | NIL ] - Specify that this slot is a transactional slot and that all reads and writes should be committed to log.
    TRANSACTIONAL   Accessor: SLOT-TRANSACTIONAL
  • Class TRANSACTIONAL-EFFECTIVE-SLOT  (STANDARD-EFFECTIVE-SLOT-DEFINITION)
    The class for effective slots of transactional classes. Exactly like TRANSACTIONAL-EFFECTIVE-SLOT.
    TRANSACTIONAL   Accessor: SLOT-TRANSACTIONAL
  • Class TRANSACTIONAL-OBJECT
    Superclass of all transactional objects.
    No slots.
  • Macro DEFTCLASS (class (&rest superclasses) (&rest slots) &rest class-options)
    Define a new transactional class caleed CLASS. DEFTCLASS is just like DEFCLASS except the default metaclass is transactional class, slots are transactional, and it inherits from TRANSACTIONAL-OBJECT by default.
  • Generic-Function STM (form)
    Translate FORM into an STM action. Define methods on this generic function with DEFSTM-WALKER.
  • Generic-Function STM (form)
    Translate FORM into an STM action. Define methods on this generic function with DEFSTM-WALKER.
  • Method STM (form)
    If FORM isn't a FORM object, we'll convert it to one, apply the transformation and convert it back.
  • Method STM (form)
    If FORM isn't a FORM object, we'll convert it to one, apply the transformation and convert it back.
  • Method STM (form)
    If FORM isn't a FORM object, we'll convert it to one, apply the transformation and convert it back.
  • Generic-Function UNSTM (form)
    Translate FORM from a STM action to a Lisp form. Define methods on this generic function with DEFUNSTM-WALKER.
  • Generic-Function UNSTM (form)
    Translate FORM from a STM action to a Lisp form. Define methods on this generic function with DEFUNSTM-WALKER.
  • Macro WITH-STM (form)
    Execute FORM as if it were run in the STM.
  • Function STMS (forms)
  • Function UNSTMS (forms)
  • Method STM ((form-375 untrans-form))
  • Method STM ((form-387 constant-form))
  • Method STM ((form-400 variable-reference))
  • Method STM ((form-427 if-form))
  • Method STM ((form-439 progn-form))
  • Method STM ((form-451 progv-form))
  • Method STM ((form-463 variable-binding-form))
  • Method STM ((form-475 labels-form))
  • Method STM ((form-495 flet-form))
  • Method STM ((form-515 lambda-function-form))
  • Method STM ((form-527 setq-form))
  • Method STM ((form-539 symbol-macrolet-form))
  • Method STM ((form-551 macrolet-form))
  • Method STM ((form-563 locally-form))
  • Method STM ((form-575 application-form))
  • Method STM ((form-632 function-object-form))
  • Method STM ((form-645 lambda-application-form))
  • Method STM ((form-657 multiple-value-call-form))
  • Method STM ((form-684 multiple-value-prog1-form))
  • Method STM ((form-696 block-form))
  • Method STM ((form-708 return-from-form))
  • Method STM ((form-720 catch-form))
  • Method STM ((form-732 throw-form))
  • Method STM ((form-744 tagbody-form))
  • Method STM ((form-756 go-tag-form))
  • Method STM ((form-769 go-form))
  • Method STM ((form-782 unwind-protect-form))
  • Method STM ((form-794 the-form))
  • Method STM ((form-806 eval-when-form))
  • Method UNSTM ((form-818 form))
  • Method UNSTM ((form-831 trans-form))
  • Method UNSTM ((form-843 variable-reference))
  • Method UNSTM ((form-870 application-form))
  • Method UNSTM ((form-898 lambda-application-form))
  • Macro TRY (&body body)
    Return a transaction that executes each transaction in BODY atomically from left to right until one succeeds. The return value of the transaction is the value of the transaction that succeeds.
  • Function RETRY
    Return a transaction that when executed, aborts the current transaction and re-executes it from scratch. The transaction will wait on all variables that have been read so far during the transaction.
  • Macro TRANS (body)
    Create a new anonymous transaction.
  • Function UNTRANS (transaction)
  • Macro DEFTRANSACTION (name (&rest args) &body body)
    Define a new transaction called NAME. DEFTRANSACTION is just like DEFMETHOD but the body is walked into an STM action.
  • Class CELL  (TRANSACTIONAL-OBJECT)
    VALUE   Accessor: VALUE-OF
  • Method EMPTY? ((cell cell))
  • Method EMPTY! ((cell cell))
  • Method TAKE ((cell cell))
  • Method PUT ((cell cell) val)
  • Method TRY-PUT ((cell cell) val)
  • Class CHAN  (TRANSACTIONAL-OBJECT)
    BUFFER   Accessor: BUFFER-OF
    SIZE   Accessor: SIZE-OF
  • Class PORT  (TRANSACTIONAL-OBJECT)
    CHAN   Accessor: CHAN-OF
    INDEX   Accessor: INDEX-OF
  • Method READ-PORT ((p port))
  • Method WRITE-CHAN ((c chan) item)
  • Class COUNTER  (TRANSACTIONAL-OBJECT)
    COUNT   Accessor: COUNT-OF
  • Method INCREMENT ((c counter) &optional (d 1))
  • Method DECREMENT ((c counter) &optional (d 1))
  • Method RESET ((c counter))
  • Method SWAP ((c1 counter) (c2 counter))
  • Class TQUEUE  (TRANSACTIONAL-OBJECT)
    HEAD   Accessor: HEAD-OF
    TAIL   Accessor: TAIL-OF
    BUFFER   Accessor: BUFFER-OF
  • Method DEQ ((q tqueue) &key remove? block?)
  • Method ENQ ((q tqueue) val)
  • Method EMPTY? ((q tqueue))
  • Method FULL? ((q tqueue))
  • Method QLENGTH ((q tqueue))
  • Method SLEEP-AFTER ((tx transaction) secs)
  • Method NOB ((tx transaction))
  • Method REPEAT ((tx transaction) n)

Also exports

  • COMMON-LISP:SEQUENCE