Blame docs/reference/glib/html/glib-Thread-Pools.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>Thread Pools: GLib Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GLib Reference Manual">
Packit ae235b
<link rel="up" href="glib-core.html" title="GLib Core Application Support">
Packit ae235b
<link rel="prev" href="glib-Threads.html" title="Threads">
Packit ae235b
<link rel="next" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Thread Pools

Packit ae235b

Thread Pools — pools of threads to execute work concurrently

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GThreadPool *
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_new ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_push ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_set_max_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_get_max_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_get_num_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_unprocessed ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_free ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_set_max_unused_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_get_max_unused_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_get_num_unused_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_stop_unused_threads ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_set_sort_function ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_set_max_idle_time ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
guint
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_get_max_idle_time ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
Packit ae235b
Packit ae235b
g_thread_pool_move_to_front ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
struct
Packit ae235b
GThreadPool
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <glib.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

Sometimes you wish to asynchronously fork out the execution of work

Packit ae235b
and continue working in your own thread. If that will happen often,
Packit ae235b
the overhead of starting and destroying a thread each time might be
Packit ae235b
too high. In such cases reusing already started threads seems like a
Packit ae235b
good idea. And it indeed is, but implementing this can be tedious
Packit ae235b
and error-prone.

Packit ae235b

Therefore GLib provides thread pools for your convenience. An added

Packit ae235b
advantage is, that the threads can be shared between the different
Packit ae235b
subsystems of your program, when they are using GLib.

Packit ae235b

To create a new thread pool, you use g_thread_pool_new().

Packit ae235b
It is destroyed by g_thread_pool_free().

Packit ae235b

If you want to execute a certain task within a thread pool,

Packit ae235b
you call g_thread_pool_push().

Packit ae235b

To get the current number of running threads you call

Packit ae235b
g_thread_pool_get_num_threads(). To get the number of still
Packit ae235b
unprocessed tasks you call g_thread_pool_unprocessed(). To control
Packit ae235b
the maximal number of threads for a thread pool, you use
Packit ae235b
g_thread_pool_get_max_threads() and g_thread_pool_set_max_threads().

Packit ae235b

Finally you can control the number of unused threads, that are kept

Packit ae235b
alive by GLib for future use. The current number can be fetched with
Packit ae235b
g_thread_pool_get_num_unused_threads(). The maximal number can be
Packit ae235b
controlled by g_thread_pool_get_max_unused_threads() and
Packit ae235b
g_thread_pool_set_max_unused_threads(). All currently unused threads
Packit ae235b
can be stopped by calling g_thread_pool_stop_unused_threads().

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_thread_pool_new ()

Packit ae235b
GThreadPool *
Packit ae235b
g_thread_pool_new (GFunc func,
Packit ae235b
                   gpointer user_data,
Packit ae235b
                   gint max_threads,
Packit ae235b
                   gboolean exclusive,
Packit ae235b
                   GError **error);
Packit ae235b

This function creates a new thread pool.

Packit ae235b

Whenever you call g_thread_pool_push(), either a new thread is

Packit ae235b
created or an unused one is reused. At most max_threads
Packit ae235b
 threads
Packit ae235b
are running concurrently for this thread pool. max_threads
Packit ae235b
 = -1
Packit ae235b
allows unlimited threads to be created for this thread pool. The
Packit ae235b
newly created or reused thread now executes the function func
Packit ae235b
Packit ae235b
with the two arguments. The first one is the parameter to
Packit ae235b
g_thread_pool_push() and the second one is user_data
Packit ae235b
.

Packit ae235b

The parameter exclusive

Packit ae235b
 determines whether the thread pool owns
Packit ae235b
all threads exclusive or shares them with other thread pools.
Packit ae235b
If exclusive
Packit ae235b
 is TRUE, max_threads
Packit ae235b
 threads are started
Packit ae235b
immediately and they will run exclusively for this thread pool
Packit ae235b
until it is destroyed by g_thread_pool_free(). If exclusive
Packit ae235b
 is
Packit ae235b
FALSE, threads are created when needed and shared between all
Packit ae235b
non-exclusive thread pools. This implies that max_threads
Packit ae235b
 may
Packit ae235b
not be -1 for exclusive thread pools. Besides, exclusive thread
Packit ae235b
pools are not affected by g_thread_pool_set_max_idle_time()
Packit ae235b
since their threads are never considered idle and returned to the
Packit ae235b
global pool.

Packit ae235b

error

Packit ae235b
 can be NULL to ignore errors, or non-NULL to report
Packit ae235b
errors. An error can only occur when exclusive
Packit ae235b
 is set to TRUE
Packit ae235b
and not all max_threads
Packit ae235b
 threads could be created.
Packit ae235b
See GThreadError for possible errors that may occur.
Packit ae235b
Note, even in case of error a valid GThreadPool is returned.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

func

Packit ae235b

a function to execute in the threads of the new thread pool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data that is handed over to func

Packit ae235b
every time it
Packit ae235b
is called

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

max_threads

Packit ae235b

the maximal number of threads to execute concurrently

Packit ae235b
in  the new thread pool, -1 means no limit

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

exclusive

Packit ae235b

should this thread pool be exclusive?

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for error, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the new GThreadPool

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_push ()

Packit ae235b
gboolean
Packit ae235b
g_thread_pool_push (GThreadPool *pool,
Packit ae235b
                    gpointer data,
Packit ae235b
                    GError **error);
Packit ae235b

Inserts data

Packit ae235b
 into the list of tasks to be executed by pool
Packit ae235b
.

Packit ae235b

When the number of currently running threads is lower than the

Packit ae235b
maximal allowed number of threads, a new thread is started (or
Packit ae235b
reused) with the properties given to g_thread_pool_new().
Packit ae235b
Otherwise, data
Packit ae235b
 stays in the queue until a thread in this pool
Packit ae235b
finishes its previous task and processes data
Packit ae235b
.

Packit ae235b

error

Packit ae235b
 can be NULL to ignore errors, or non-NULL to report
Packit ae235b
errors. An error can only occur when a new thread couldn't be
Packit ae235b
created. In that case data
Packit ae235b
 is simply appended to the queue of
Packit ae235b
work to do.

Packit ae235b

Before version 2.32, this function did not return a success status.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

a new task for pool

Packit ae235b

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for error, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

TRUE on success, FALSE if an error occurred

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_set_max_threads ()

Packit ae235b
gboolean
Packit ae235b
g_thread_pool_set_max_threads (GThreadPool *pool,
Packit ae235b
                               gint max_threads,
Packit ae235b
                               GError **error);
Packit ae235b

Sets the maximal allowed number of threads for pool

Packit ae235b
.
Packit ae235b
A value of -1 means that the maximal number of threads
Packit ae235b
is unlimited. If pool
Packit ae235b
 is an exclusive thread pool, setting
Packit ae235b
the maximal number of threads to -1 is not allowed.

Packit ae235b

Setting max_threads

Packit ae235b
 to 0 means stopping all work for pool
Packit ae235b
.
Packit ae235b
It is effectively frozen until max_threads
Packit ae235b
 is set to a non-zero
Packit ae235b
value again.

Packit ae235b

A thread is never terminated while calling func

Packit ae235b
, as supplied by
Packit ae235b
g_thread_pool_new(). Instead the maximal number of threads only
Packit ae235b
has effect for the allocation of new threads in g_thread_pool_push().
Packit ae235b
A new thread is allocated, whenever the number of currently
Packit ae235b
running threads in pool
Packit ae235b
 is smaller than the maximal number.

Packit ae235b

error

Packit ae235b
 can be NULL to ignore errors, or non-NULL to report
Packit ae235b
errors. An error can only occur when a new thread couldn't be
Packit ae235b
created.

Packit ae235b

Before version 2.32, this function did not return a success status.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

max_threads

Packit ae235b

a new maximal number of threads for pool

Packit ae235b
,
Packit ae235b
or -1 for unlimited

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for error, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

TRUE on success, FALSE if an error occurred

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_get_max_threads ()

Packit ae235b
gint
Packit ae235b
g_thread_pool_get_max_threads (GThreadPool *pool);
Packit ae235b

Returns the maximal number of threads for pool

Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the maximal number of threads

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_get_num_threads ()

Packit ae235b
guint
Packit ae235b
g_thread_pool_get_num_threads (GThreadPool *pool);
Packit ae235b

Returns the number of threads currently running in pool

Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the number of threads currently running

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_unprocessed ()

Packit ae235b
guint
Packit ae235b
g_thread_pool_unprocessed (GThreadPool *pool);
Packit ae235b

Returns the number of tasks still unprocessed in pool

Packit ae235b
.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

the number of unprocessed tasks

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_free ()

Packit ae235b
void
Packit ae235b
g_thread_pool_free (GThreadPool *pool,
Packit ae235b
                    gboolean immediate,
Packit ae235b
                    gboolean wait_);
Packit ae235b

Frees all resources allocated for pool

Packit ae235b
.

Packit ae235b

If immediate

Packit ae235b
 is TRUE, no new task is processed for pool
Packit ae235b
.
Packit ae235b
Otherwise pool
Packit ae235b
 is not freed before the last task is processed.
Packit ae235b
Note however, that no thread of this pool is interrupted while
Packit ae235b
processing a task. Instead at least all still running threads
Packit ae235b
can finish their tasks before the pool
Packit ae235b
 is freed.

Packit ae235b

If wait_

Packit ae235b
 is TRUE, the functions does not return before all
Packit ae235b
tasks to be processed (dependent on immediate
Packit ae235b
, whether all
Packit ae235b
or only the currently running) are ready.
Packit ae235b
Otherwise the function returns immediately.

Packit ae235b

After calling this function pool

Packit ae235b
 must not be used anymore.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

immediate

Packit ae235b

should pool

Packit ae235b
shut down immediately?

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

wait_

Packit ae235b

should the function wait for all tasks to be finished?

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_set_max_unused_threads ()

Packit ae235b
void
Packit ae235b
g_thread_pool_set_max_unused_threads (gint max_threads);
Packit ae235b

Sets the maximal number of unused threads to max_threads

Packit ae235b
.
Packit ae235b
If max_threads
Packit ae235b
 is -1, no limit is imposed on the number
Packit ae235b
of unused threads.

Packit ae235b

The default value is 2.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

max_threads

Packit ae235b

maximal number of unused threads

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_get_max_unused_threads ()

Packit ae235b
gint
Packit ae235b
g_thread_pool_get_max_unused_threads (void);
Packit ae235b

Returns the maximal allowed number of unused threads.

Packit ae235b
Packit ae235b

Returns

Packit ae235b

the maximal number of unused threads

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_get_num_unused_threads ()

Packit ae235b
guint
Packit ae235b
g_thread_pool_get_num_unused_threads (void);
Packit ae235b

Returns the number of currently unused threads.

Packit ae235b
Packit ae235b

Returns

Packit ae235b

the number of currently unused threads

Packit ae235b
Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_stop_unused_threads ()

Packit ae235b
void
Packit ae235b
g_thread_pool_stop_unused_threads (void);
Packit ae235b

Stops all currently unused threads. This does not change the

Packit ae235b
maximal number of unused threads. This function can be used to
Packit ae235b
regularly stop all unused threads e.g. from g_timeout_add().

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_set_sort_function ()

Packit ae235b
void
Packit ae235b
g_thread_pool_set_sort_function (GThreadPool *pool,
Packit ae235b
                                 GCompareDataFunc func,
Packit ae235b
                                 gpointer user_data);
Packit ae235b

Sets the function used to sort the list of tasks. This allows the

Packit ae235b
tasks to be processed by a priority determined by func
Packit ae235b
, and not
Packit ae235b
just in the order in which they were added to the pool.

Packit ae235b

Note, if the maximum number of threads is more than 1, the order

Packit ae235b
that threads are executed cannot be guaranteed 100%. Threads are
Packit ae235b
scheduled by the operating system and are executed at random. It
Packit ae235b
cannot be assumed that threads are executed in the order they are
Packit ae235b
created.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

func

Packit ae235b

the GCompareDataFunc used to sort the list of tasks.

Packit ae235b
This function is passed two tasks. It should return
Packit ae235b
0 if the order in which they are handled does not matter,
Packit ae235b
a negative value if the first task should be processed before
Packit ae235b
the second or a positive value if the second task should be
Packit ae235b
processed first.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data passed to func

Packit ae235b

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.10

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_set_max_idle_time ()

Packit ae235b
void
Packit ae235b
g_thread_pool_set_max_idle_time (guint interval);
Packit ae235b

This function will set the maximum interval

Packit ae235b
 that a thread
Packit ae235b
waiting in the pool for new tasks can be idle for before
Packit ae235b
being stopped. This function is similar to calling
Packit ae235b
g_thread_pool_stop_unused_threads() on a regular timeout,
Packit ae235b
except this is done on a per thread basis.

Packit ae235b

By setting interval

Packit ae235b
 to 0, idle threads will not be stopped.

Packit ae235b

The default value is 15000 (15 seconds).

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

interval

Packit ae235b

the maximum interval

Packit ae235b
(in milliseconds)
Packit ae235b
a thread can be idle

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.10

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_get_max_idle_time ()

Packit ae235b
guint
Packit ae235b
g_thread_pool_get_max_idle_time (void);
Packit ae235b

This function will return the maximum interval

Packit ae235b
 that a
Packit ae235b
thread will wait in the thread pool for new tasks before
Packit ae235b
being stopped.

Packit ae235b

If this function returns 0, threads waiting in the thread

Packit ae235b
pool for new work are not stopped.

Packit ae235b
Packit ae235b

Returns

Packit ae235b

the maximum interval

Packit ae235b
(milliseconds) to wait
Packit ae235b
for new tasks in the thread pool before stopping the
Packit ae235b
thread

Packit ae235b
Packit ae235b

Since: 2.10

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_thread_pool_move_to_front ()

Packit ae235b
gboolean
Packit ae235b
g_thread_pool_move_to_front (GThreadPool *pool,
Packit ae235b
                             gpointer data);
Packit ae235b

Moves the item to the front of the queue of unprocessed

Packit ae235b
items, so that it will be processed next.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

pool

Packit ae235b

a GThreadPool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

data

Packit ae235b

an unprocessed item in the pool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

TRUE if the item was found and moved

Packit ae235b
Packit ae235b

Since: 2.46

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

struct GThreadPool

Packit ae235b
struct GThreadPool {
Packit ae235b
  GFunc func;
Packit ae235b
  gpointer user_data;
Packit ae235b
  gboolean exclusive;
Packit ae235b
};
Packit ae235b
Packit ae235b

The GThreadPool struct represents a thread pool. It has three

Packit ae235b
public read-only members, but the underlying struct is bigger,
Packit ae235b
so you must not copy this struct.

Packit ae235b
Packit ae235b

Members

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GFunc func;

Packit ae235b

the function to execute in the threads of this pool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

gpointer user_data;

Packit ae235b

the user data for the threads of this pool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

gboolean exclusive;

Packit ae235b

are all threads exclusive to this pool

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

See Also

Packit ae235b

GThread

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>