12.07.2015 Views

Shared State Concurrency - Common Lisp.net

Shared State Concurrency - Common Lisp.net

Shared State Concurrency - Common Lisp.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BarriersA Barrier, is a synchronization mechanism used by a fixed number of threads. Aseach thread reaches the barrier it blocks. When the last thread reach the barrier, allblocked threads are unblocked and the barrier is reset to be used in a new iteration.make-barrier count &key name &allow-other-keysFunctionThis creates and returns a barrier with count participant threads. It is an error ifcount is not a positive integer.pass-barrier barrierFunctionThis blocks the current thread until the required number of threads have calledpass-barrier on barrier. When that occurs, two things happen: the barrier is resetto be used again, in a new iteration; all threads that were blocked are unblockedand this function returns t in one of the threads and nil in all the others.pass-barrier/timeout barrier timeoutFunctionThis is similar to pass-barrier, but it returns :timeout if timeout seconds passand some of the other participant threads have not passed yet.barrierp objectThis is a predicate that is true if object is a cyclic barrier.barrier-name barrierFunctionFunctionThis return the name of barrier. The name of a barrier can be altered with setf.12

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!