Common Lisp Package: LPARALLEL.PROMISE

Promises and futures.

README:

FUNCTION

Public

CHAIN (OBJECT)

Create a chain. A chain links objects together by relaying `force' and `fulfilledp' calls.

FORCE (OBJECT)

If `object' is a promise and the promise is fulfilled, return the fulfilled value (possibly multiple values). If the promise is unfulfilled then the call blocks until the promise is fulfilled. If `object' is a chain, call `force' on the chained object. If `object' is not a promise and not a chain, return the identical object passed. Note if `force' is called on an unfulfilled future then the future is fulfilled by the caller of `force'.

FULFILLEDP (OBJECT)

If `object' is a promise, return a boolean indicating whether the promise is fulfilled. If `object' is a chain, call `fulfilledp' on the chained object. If `object' is not a promise and not a chain, return true.

PROMISE

Create a promise. A promise is a receptacle for a result which is unknown at the time it is created.

Private

%%%%.%CHAIN.OBJECT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%DELAY.FN (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%DELAY.LOCK (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%DELAY.RESULT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%FUTURE.CANCELEDP (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%FUTURE.FN (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%FUTURE.LOCK (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%FUTURE.RESULT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%PROMISE.AVAILABLEP (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%PROMISE.CVAR (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%PROMISE.LOCK (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.%PROMISE.RESULT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.PLAN.FN (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.PLAN.LOCK (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.PLAN.RESULT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.PROMISE-BASE.LOCK (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

%%%%.PROMISE-BASE.RESULT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CHAIN-OBJECT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PLAN-FN (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

RESULT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

UNWRAP-RESULT (RESULT)

In `receive-result', this is called on the stored task result. The user receives the return value of this function.

WRAP-ERROR (CONDITION)

Wrap an error. A non-error condition may also be wrapped, though it will still be signaled with `error'.

Undocumented

SETF%%%%.%CHAIN.OBJECT (NEW-VALUE INSTANCE)

SETF%%%%.%DELAY.FN (NEW-VALUE INSTANCE)

SETF%%%%.%DELAY.LOCK (NEW-VALUE INSTANCE)

SETF%%%%.%DELAY.RESULT (NEW-VALUE INSTANCE)

SETF%%%%.%FUTURE.CANCELEDP (NEW-VALUE INSTANCE)

SETF%%%%.%FUTURE.FN (NEW-VALUE INSTANCE)

SETF%%%%.%FUTURE.LOCK (NEW-VALUE INSTANCE)

SETF%%%%.%FUTURE.RESULT (NEW-VALUE INSTANCE)

SETF%%%%.%PROMISE.AVAILABLEP (NEW-VALUE INSTANCE)

SETF%%%%.%PROMISE.CVAR (NEW-VALUE INSTANCE)

SETF%%%%.%PROMISE.LOCK (NEW-VALUE INSTANCE)

SETF%%%%.%PROMISE.RESULT (NEW-VALUE INSTANCE)

SETF%%%%.PLAN.FN (NEW-VALUE INSTANCE)

SETF%%%%.PLAN.LOCK (NEW-VALUE INSTANCE)

SETF%%%%.PLAN.RESULT (NEW-VALUE INSTANCE)

SETF%%%%.PROMISE-BASE.LOCK (NEW-VALUE INSTANCE)

SETF%%%%.PROMISE-BASE.RESULT (NEW-VALUE INSTANCE)

%CHAIN-P (OBJECT)

%DELAY-P (OBJECT)

%FUTURE-P (OBJECT)

%PROMISE-P (OBJECT)

CALL-WITH-TASK-HANDLER

COPY-%CHAIN (INSTANCE)

COPY-%DELAY (INSTANCE)

COPY-%FUTURE (INSTANCE)

COPY-%PROMISE (INSTANCE)

COPY-PLAN (INSTANCE)

COPY-PROMISE-BASE (INSTANCE)

FORCE-DELAY (DELAY)

FORCE-FUTURE (FUTURE)

FORCE-PROMISE (PROMISE)

FULFILL-DELAY (DELAY CLIENT-FN)

FULFILL-FUTURE (FUTURE CLIENT-FN)

FULFILL-OBJECT (OBJECT CLIENT-FN)

FULFILL-PLAN/CALL (PLAN)

FULFILL-PLAN/ERROR (PLAN ERR)

FULFILL-PLAN/VALUES (PLAN VALUES)

FULFILL-PROMISE (PROMISE CLIENT-FN)

MAKE-%CHAIN-INSTANCE (&KEY ((OBJECT DUM322) (ERROR slot ~a in ~a not initialized 'OBJECT '%CHAIN)))

MAKE-%DELAY-INSTANCE (&KEY ((RESULT DUM266) +NO-RESULT+) ((LOCK DUM267) (MAKE-LOCK)) ((FN DUM268) (ERROR slot ~a in ~a not initialized 'FN 'PLAN)))

MAKE-%FUTURE-INSTANCE (&KEY ((RESULT DUM189) +NO-RESULT+) ((LOCK DUM190) (MAKE-LOCK)) ((FN DUM191) (ERROR slot ~a in ~a not initialized 'FN 'PLAN)) ((CANCELEDP DUM192) NIL))

MAKE-%PROMISE-INSTANCE (&KEY ((RESULT DUM55) +NO-RESULT+) ((LOCK DUM56) (MAKE-LOCK)) ((CVAR DUM57) NIL) ((AVAILABLEP DUM58) T))

MAKE-FUTURE (FN)

MAKE-FUTURE-TASK

MAKE-PLAN-INSTANCE (&KEY ((RESULT DUM126) +NO-RESULT+) ((LOCK DUM127) (MAKE-LOCK)) ((FN DUM128) (ERROR slot ~a in ~a not initialized 'FN 'PLAN)))

MAKE-PROMISE-BASE-INSTANCE (&KEY ((RESULT DUM0) +NO-RESULT+) ((LOCK DUM1) (MAKE-LOCK)))

MAKE-TASK

PLAN-P (OBJECT)

PROMISE-BASE-P (OBJECT)

REPLACE-ERROR (PROMISE)

SUBMIT-RAW-TASK (TASK KERNEL)

MACRO

Public

DELAY (&BODY BODY)

Create a delay. A delay is a promise which is fulfilled when `force' is called upon it.

FULFILL (OBJECT &BODY BODY)

Attempt to give `object' a value. If `object' is a promise which is not fulfilled and not currently being fulfilled, then the implicit progn `body' will be executed and the promise will store the result. In this case `fulfill' returns true. If `object' is a promise that is either already fulfilled or actively being fulfilled, then `body' will not be executed and `fulfill' returns false. If `object' is a chain, call `fullfill' on the chained object. If `object' is not a promise and not a chain then false is returned immediately, with `body' being ignored.

FUTURE (&BODY BODY)

Create a future. A future is a promise which is fulfilled in parallel by the implicit progn `body'.

SPECULATE (&BODY BODY)

Create a speculation. A speculation is a low-priority future.

Private

Undocumented

MAKE-TASK-FN (&BODY BODY)

WITH-%CHAIN-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-%DELAY-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-%FUTURE-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-%PROMISE-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-LOCK-OPERATION (OPERATION PROMISE &BODY BODY)

WITH-PLAN-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-PROMISE-BASE-SLOTS (SLOTS INSTANCE &BODY BODY)

WITH-UNFULFILLED-FUTURE/NO-WAIT (FUTURE &BODY BODY)

WITH-UNFULFILLED/NO-WAIT (PROMISE &BODY BODY)

WITH-UNFULFILLED/WAIT (PROMISE &BODY BODY)

CLASS

Private

WRAPPED-ERROR

This is a container for transferring an error that occurs inside `call-with-task-handler' to the calling thread.

Undocumented

%CHAIN

%DELAY

%FUTURE

%PROMISE

PLAN

PROMISE-BASE

CONSTANT

Private

Undocumented

+NO-RESULT+