Details
struct RRWorkPool
struct RRWorkPool {
gint max_threads;
gint num_threads;
GSList *work;
GSList *active;
GMutex *mutex;
GCond *add_cond;
GCond *remove_cond;
gboolean shutdown;
}; |
RRWPGROUP()
#define RRWPGROUP(x) ((RRWPGroup)x) |
rr_work_pool_new ()
Create a new work pool. The RRWorkPool works like an ordinary thread pool
with the exception that each "work item" is assigned a gid (group id).
But the work pool guarantees that two items with the same gid value
cant be executed in parallel.
rr_work_pool_free ()
Waits until all work items have been executed then all resourced used by
the work pool are returned to the operating system.
rr_work_pool_push ()
void rr_work_pool_push (RRWorkPool *pool,
RRWPGroup gid,
GFunc func,
gpointer data,
gpointer user_data); |
Inserts func to the list of task to be executed by the pool.
The work pool guarantees that two or more tasks with the same
gid will never be executed in parallel.
rr_work_pool_join ()
blocks until all tasks of the given gid are executed.