1.1 --- a/epoc32/include/stdapis/glib-2.0/glib/gthreadpool.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/stdapis/glib-2.0/glib/gthreadpool.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,113 @@
1.4 -gthreadpool.h
1.5 +/* GLIB - Library of useful routines for C programming
1.6 + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
1.7 + * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.8 + *
1.9 + * This library is free software; you can redistribute it and/or
1.10 + * modify it under the terms of the GNU Lesser General Public
1.11 + * License as published by the Free Software Foundation; either
1.12 + * version 2 of the License, or (at your option) any later version.
1.13 + *
1.14 + * This library is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.17 + * Lesser General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU Lesser General Public
1.20 + * License along with this library; if not, write to the
1.21 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.22 + * Boston, MA 02111-1307, USA.
1.23 + */
1.24 +
1.25 +/*
1.26 + * Modified by the GLib Team and others 1997-2000. See the AUTHORS
1.27 + * file for a list of people on the GLib Team. See the ChangeLog
1.28 + * files for a list of changes. These files are distributed with
1.29 + * GLib at ftp://ftp.gtk.org/pub/gtk/.
1.30 + */
1.31 +
1.32 +#ifndef __G_THREADPOOL_H__
1.33 +#define __G_THREADPOOL_H__
1.34 +
1.35 +#include <_ansi.h>
1.36 +#include <glib/gthread.h>
1.37 +
1.38 +G_BEGIN_DECLS
1.39 +
1.40 +typedef struct _GThreadPool GThreadPool;
1.41 +
1.42 +/* Thread Pools
1.43 + */
1.44 +
1.45 +/* The real GThreadPool is bigger, so you may only create a thread
1.46 + * pool with the constructor function */
1.47 +struct _GThreadPool
1.48 +{
1.49 + GFunc func;
1.50 + gpointer user_data;
1.51 + gboolean exclusive;
1.52 +};
1.53 +
1.54 +/* Get a thread pool with the function func, at most max_threads may
1.55 + * run at a time (max_threads == -1 means no limit), exclusive == TRUE
1.56 + * means, that the threads shouldn't be shared and that they will be
1.57 + * prestarted (otherwise they are started as needed) user_data is the
1.58 + * 2nd argument to the func */
1.59 +IMPORT_C GThreadPool* g_thread_pool_new (GFunc func,
1.60 + gpointer user_data,
1.61 + gint max_threads,
1.62 + gboolean exclusive,
1.63 + GError **error);
1.64 +
1.65 +/* Push new data into the thread pool. This task is assigned to a thread later
1.66 + * (when the maximal number of threads is reached for that pool) or now
1.67 + * (otherwise). If necessary a new thread will be started. The function
1.68 + * returns immediatly */
1.69 +IMPORT_C void g_thread_pool_push (GThreadPool *pool,
1.70 + gpointer data,
1.71 + GError **error);
1.72 +
1.73 +/* Set the number of threads, which can run concurrently for that pool, -1
1.74 + * means no limit. 0 means has the effect, that the pool won't process
1.75 + * requests until the limit is set higher again */
1.76 +IMPORT_C void g_thread_pool_set_max_threads (GThreadPool *pool,
1.77 + gint max_threads,
1.78 + GError **error);
1.79 +IMPORT_C gint g_thread_pool_get_max_threads (GThreadPool *pool);
1.80 +
1.81 +/* Get the number of threads assigned to that pool. This number doesn't
1.82 + * necessarily represent the number of working threads in that pool */
1.83 +IMPORT_C guint g_thread_pool_get_num_threads (GThreadPool *pool);
1.84 +
1.85 +/* Get the number of unprocessed items in the pool */
1.86 +IMPORT_C guint g_thread_pool_unprocessed (GThreadPool *pool);
1.87 +
1.88 +/* Free the pool, immediate means, that all unprocessed items in the queue
1.89 + * wont be processed, wait means, that the function doesn't return immediatly,
1.90 + * but after all threads in the pool are ready processing items. immediate
1.91 + * does however not mean, that threads are killed. */
1.92 +IMPORT_C void g_thread_pool_free (GThreadPool *pool,
1.93 + gboolean immediate,
1.94 + gboolean wait);
1.95 +
1.96 +/* Set the maximal number of unused threads before threads will be stopped by
1.97 + * GLib, -1 means no limit */
1.98 +IMPORT_C void g_thread_pool_set_max_unused_threads (gint max_threads);
1.99 +IMPORT_C gint g_thread_pool_get_max_unused_threads (void);
1.100 +IMPORT_C guint g_thread_pool_get_num_unused_threads (void);
1.101 +
1.102 +/* Stop all currently unused threads, but leave the limit untouched */
1.103 +IMPORT_C void g_thread_pool_stop_unused_threads (void);
1.104 +
1.105 +/* Set sort function for priority threading */
1.106 +IMPORT_C void g_thread_pool_set_sort_function (GThreadPool *pool,
1.107 + GCompareDataFunc func,
1.108 + gpointer user_data);
1.109 +
1.110 +/* Set maximum time a thread can be idle in the pool before it is stopped */
1.111 +IMPORT_C void g_thread_pool_set_max_idle_time (guint interval);
1.112 +IMPORT_C guint g_thread_pool_get_max_idle_time (void);
1.113 +
1.114 +G_END_DECLS
1.115 +
1.116 +#endif /* __G_THREADPOOL_H__ */
1.117 +