WorkerPool


Object Hierarchy:

Object hierarchy for WorkerPool

Description:

public class WorkerPool : Object

Fixed-size worker pool for executing tasks concurrently.

WorkerPool manages a pool of worker threads and a task queue. Tasks submitted via submitInt, submitString, execute etc. are queued and processed by the next available worker thread.

Example:

    var pool = WorkerPool.withDefault ();
pool.execute (() => {
// background work
});
pool.shutdown ();

Example with return value:

    var created = WorkerPool.of (4);
if (created.isError ()) {
return;
}
var pool = created.unwrap ();
int result = pool.submitInt (() => { return 42; }).await ();
pool.shutdown ();


Namespace: Vala.Concurrent
Package: Valacore

Content:

Static methods:

Methods:

Inherited Members:

All known members inherited from class GLib.Object