threads.pl -- Threading utilities.

author
- Daniel Beßler
license
- BSD
 message_queue_materialize(+Queue, -Term) is nondet
Retrieves and removes Term from queue. This will block until at least one message is available in the queue before returning a result or failing. A choicepoint is created for the next queue element until end_of_stream reached. It is not ensured that this call is deterministic in case there is only one message before end_of_stream (it is deterministic if end_of_stream was already queued when the last message was retrieved).
Arguments:
Queue- a message queue.
Term- queued message
See also
- https://www.swi-prolog.org/pldoc/man?section=msgqueue
 worker_pool_create(+WorkerPool) is det
Same as worker_pool_create/2 with empty options.
Arguments:
WorkerPool- the worker pool name.
 worker_pool_create(+WorkerPool, +Options) is det
Creates a new thread pool with worker threads. Options include:
initial_pool_size(InitialSize)
Determines the number of threads initially started. Default is 2.
Arguments:
WorkerPool- the worker pool name.
Options- additional options.
 worker_pool_start_work(+WorkerPool, -WorkID, +WorkerGoal) is det
Schedules a new work goal. worker_pool_stop_work/2 must be called once the work is done. This is usually done by wrapping it into a call of setup_call_cleanup/3.
Arguments:
WorkerPool- the worker pool name.
WorkID- the work ID.
WorkerGoal- the goal of each worker.
 worker_pool_join(+PoolID, +WorkID) is det
Block the current thread until work is done.
 worker_pool_stop_work(+WorkerPool, -WorkID) is det
Unschedule any remaining work associated to WorkID. This may not immediately shut-down all operations, but will prevent any more results to be communicated, and new operations being started.
Arguments:
WorkerPool- the worker pool name.
WorkID- the work ID.