Common Lisp Package: EAGER-FUTURE2

README:

FUNCTION

Public

ADVISE-THREAD-POOL-SIZE (NEW-SIZE)

Attempts to set the amount of threads in the thread pool to given value.

FORCE (FUTURE &REST VALUES)

If the future has not yet yielded a value, installs the given values as the yield-values of the future (stopping any ongoing computation of the future).

FORCE-ALL (FUTURES &REST VALUES)

Calls force on all given future with values. Useful to stop remaining computations in for example iterate-futures.

ITERATE-FUTURES (PROC FUTURES)

Calls proc on each future in select order. Proc is a procedure that takes the currently yieldable future as its first argument, and the list of futures not yet processed as its second. Futures need to be yielded by proc - this is done so that proc can have control of error handling. The second argument is useful to for example be able to terminate remaining computations before a non-local control transfer.

PCALL (THUNK &OPTIONAL (FUTURE-TYPE *DEFAULT-FUTURE-TYPE*))

Given a function of no arguments, returns an object (called a future) that can later be used to retrieve the values computed by the function. future-type (by default the value of *default-future-type*) can either be :eager, :speculative, or :lazy. See the documentation of *default-future-type* for an explanation of the different future types. The function is called in an unspecified dynamic environment.

READY-TO-YIELD? (FUTURE)

Returns non-nil if the future values have been computed, nil otherwise.

SELECT (&REST FUTURES)

Returns the first future that is ready to yield.

SELECT-TIMEOUT (TIMEOUT &REST FUTURES)

Given a timeout (in seconds) and a set of futures, returns either nil if no futures are ready to yield when timeout seconds have elapsed, or the first yieldable future otherwise.

THREAD-POOL-SIZE

Returns the current number of threads in the thread pool. This number determines the maximum amount of speculative futures that can be computed at the same time.

TOUCH (X)

If x is a future, yields its value, otherwise returns x.

YIELD (FUTURE)

Returns the computed values of the future. In case of a delayed future, computes the value of the future in the current thread. In case of a speculative future, if no other thread is computing the value of the future, computes the value in the current thread. If another thread is currently computing the value of the future, blocks until the value is available. In case of an eager future, blocks until the value is available.

Private

Undocumented

%READY-TO-YIELD? (FUTURE)

ABORT-SCHEDULED-FUTURE-TASK (THREAD FUTURE-ID)

MAKE-FUTURE (TASK FUTURE-ID)

MAKE-POOL-THREAD

MAKE-SCHEDULER-TASK (FUTURE-PTR)

SCHEDULE-FUTURE (FUTURE FUTURE-TYPE)

SCHEDULE-IMMEDIATE (TASK)

SCHEDULE-LAST (TASK)

MACRO

Public

PAND (&REST EXPRS)

Evaluates expressions in parallel. If any expression yields nil, terminates all outstanding computations and returns nil. If all expressions yield a non-nil value, returns t.

PEXEC (&BODY BODY)

Shorthand for (pcall (lambda () ...))

PFUNCALL (FUNCTION &REST ARGS)

Evaluates args in parallel before funcalling the given function on them.

PLET ((&REST BINDINGS) &BODY BODY)

Like LET, but all bindings are evaluated asynchronously.

POR (&REST EXPRS)

Evaluates expressions in parallel. Returns the value of the first expression that yields a non-nil value. If all expressions evaluate to nil, returns nil.

SLOT-ACCESSOR

Private

Undocumented

%VALUES (OBJECT)

SETF%VALUES (NEW-VALUE OBJECT)

COMPUTING-THREAD (OBJECT)

SETFCOMPUTING-THREAD (NEW-VALUE OBJECT)

ERROR-DESCRIPTOR (OBJECT)

SETFERROR-DESCRIPTOR (NEW-VALUE OBJECT)

FUTURE-ID (OBJECT)

LOCK (OBJECT)

PROXY-RESTART (OBJECT)

SETFPROXY-RESTART (NEW-VALUE OBJECT)

RESTART-NOTIFIER (OBJECT)

SETFRESTART-NOTIFIER (NEW-VALUE OBJECT)

TASK (OBJECT)

SETFTASK (NEW-VALUE OBJECT)

WAIT-LIST (OBJECT)

SETFWAIT-LIST (NEW-VALUE OBJECT)

VARIABLE

Public

*DEFAULT-FUTURE-TYPE*

One of :eager, :speculative (default) or :lazy. If eager, any newly created futures start their computation immediately. If speculative, newly created futures are computed when thread pool threads are available, in FIFO future creation order. If lazy, newly created futures are not computed until asked to yield their values.

Private

*COMPUTING-FUTURE*

Part of scheduling protocol for thread-pooled futures.

Undocumented

*FREE-THREADS*

*LEADER-NOTIFIER*

*TASK-QUEUE*

*TASK-QUEUE-LOCK*

*THREAD-COUNTER-LOCK*

*TOTAL-THREADS*

CLASS

Public

Undocumented

FUTURE