Next: Exceptions, Previous: Lazy evaluation, Up: Program structure [Contents][Index]
There is a very preliminary interface to create parallel threads.
The interface is similar to the standard delay
/force
,
where a thread is basically the same as a promise, except that
evaluation may be in parallel.
Creates a new thread that evaluates expression.
(The result extends java.lang.Thread
and
implements gnu.mapping.Lazy
.)
The standard force
function is generalized to also work
on threads. It waits for the thread’s expression to finish
executing, and returns the result.
Creates a new Runnable
instance from a function.
Useful for passing to Java code that expects a Runnable
.
You can get the result (a value or a thrown exception) using the
getResult
method.
Synchronize on the given object. (This means getting an
exclusive lock on the object, by acquiring its monitor.)
Then execute the forms while holding the lock.
When the forms finish (normally or abnormally by throwing
an exception), the lock is released.
Returns the result of the last form.
Equivalent to the Java synchronized
statement,
except that it may return a result.