Renamed 'value' and 'arg' to 'data' and 'thread_func' to 'func' to make it
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>
Wed, 9 May 2001 12:51:21 +0000 (12:51 +0000)
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>
Wed, 9 May 2001 12:51:21 +0000 (12:51 +0000)
2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

* gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
'thread_func' to 'func' to make it more consistent with the rest
of GLib.

* gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
members of GThreadPool to the private ones. Renamed 'thread_func'
to 'func' as above. Moved up 'user_data' in g_thead_pool_new
argument list and in GThreadPool struct.

16 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gthread.c
glib/gthread.h
glib/gthreadpool.c
glib/gthreadpool.h
gthread.c
gthread.h
gthreadpool.c
gthreadpool.h

index 53aaa59..97606ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index 53aaa59..97606ad 100644 (file)
@@ -1,3 +1,14 @@
+2001-05-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
+
+       * gthread.c, gthread.h: Renamed 'value' and 'arg' to 'data' and
+       'thread_func' to 'func' to make it more consistent with the rest
+       of GLib.
+
+       * gthreadpool.c, gthreadpool.h: Moved 'stack_size' from the public
+       members of GThreadPool to the private ones. Renamed 'thread_func'
+       to 'func' as above. Moved up 'user_data' in g_thead_pool_new
+       argument list and in GThreadPool struct.
+       
 Tue May  8 15:33:31 2001  Tim Janik  <timj@gtk.org>
 
        * gcompletion.h: removed #include <unistd.h> sneaked in by
index e3b8a5b..635d9e8 100644 (file)
@@ -535,14 +535,14 @@ g_thread_create_proxy (gpointer data)
     SET_PRIO (thread->pid, thread->thread.priority);
 #endif /* G_THREAD_USE_PID_SURROGATE */
 
-  thread->retval = thread->thread.func (thread->thread.arg);
+  thread->retval = thread->thread.func (thread->thread.data);
 
   return NULL;
 }
 
 GThread* 
-g_thread_create (GThreadFunc            thread_func,
-                gpointer                arg,
+g_thread_create (GThreadFunc            func,
+                gpointer                data,
                 gulong                  stack_size,
                 gboolean                joinable,
                 gboolean                bound,
@@ -551,15 +551,15 @@ g_thread_create (GThreadFunc               thread_func,
 {
   GRealThread* result = g_new (GRealThread, 1);
   GError *local_error = NULL;
-  g_return_val_if_fail (thread_func, NULL);
+  g_return_val_if_fail (func, NULL);
   g_return_val_if_fail (priority >= G_THREAD_PRIORITY_LOW, NULL);
   g_return_val_if_fail (priority <= G_THREAD_PRIORITY_URGENT, NULL);
   
   result->thread.joinable = joinable;
   result->thread.bound = bound;
   result->thread.priority = priority;
-  result->thread.func = thread_func;
-  result->thread.arg = arg;
+  result->thread.func = func;
+  result->thread.data = data;
   result->private_data = NULL; 
   result->context = NULL;
   G_LOCK (g_thread);
@@ -657,7 +657,7 @@ g_thread_self (void)
       thread->thread.priority = G_THREAD_PRIORITY_NORMAL; /* This is
                                                             just a guess */
       thread->thread.func = NULL;
-      thread->thread.arg = NULL;
+      thread->thread.data = NULL;
       thread->private_data = NULL;
       thread->context = NULL;
 
index 6a1bfba..4e2fcf3 100644 (file)
@@ -43,7 +43,7 @@ typedef enum
   G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */
 } GThreadError;
 
-typedef gpointer (*GThreadFunc) (gpointer value);
+typedef gpointer (*GThreadFunc) (gpointer data);
 
 typedef enum
 {
@@ -56,11 +56,11 @@ typedef enum
 typedef struct _GThread         GThread;
 struct  _GThread
 {
+  GThreadFunc func;
+  gpointer data;
   gboolean joinable;
   gboolean bound;
   GThreadPriority priority;
-  GThreadFunc func;
-  gpointer arg;
 };
 
 typedef struct _GMutex          GMutex;
@@ -89,8 +89,8 @@ struct _GThreadFunctions
   gpointer  (*private_get)        (GPrivate             *private_key);
   void      (*private_set)        (GPrivate             *private_key,
                                    gpointer              data);
-  void      (*thread_create)      (GThreadFunc           thread_func,
-                                   gpointer              arg,
+  void      (*thread_create)      (GThreadFunc           func,
+                                   gpointer              data,
                                    gulong                stack_size,
                                    gboolean              joinable,
                                    gboolean              bound,
@@ -194,8 +194,8 @@ GMutex* g_static_mutex_get_mutex_impl   (GMutex **mutex);
                                                        (private_key, value))
 #define g_thread_yield()              G_THREAD_CF (thread_yield, (void)0, ())
 
-GThread* g_thread_create       (GThreadFunc            thread_func,
-                                gpointer               arg,
+GThread* g_thread_create       (GThreadFunc            func,
+                                gpointer               data,
                                 gulong                 stack_size,
                                 gboolean               joinable,
                                 gboolean               bound,
index 9cfba54..f97961a 100644 (file)
@@ -31,6 +31,7 @@ typedef struct _GRealThreadPool GRealThreadPool;
 struct _GRealThreadPool
 {
   GThreadPool pool;
+  gulong stack_size;
   GAsyncQueue* queue;
   gint max_threads;
   gint num_threads;
@@ -73,7 +74,7 @@ g_thread_pool_thread_proxy (gpointer data)
     {
       gpointer task; 
       gboolean goto_global_pool = 
-       !pool->pool.exclusive && pool->pool.stack_size == 0;
+       !pool->pool.exclusive && pool->stack_size == 0;
       gint len = g_async_queue_length_unlocked (pool->queue);
       
       if (g_thread_should_run (pool, len))
@@ -116,7 +117,7 @@ g_thread_pool_thread_proxy (gpointer data)
              else if (pool->running || !pool->immediate)
                {
                  g_async_queue_unlock (pool->queue);
-                 pool->pool.thread_func (task, pool->pool.user_data);
+                 pool->pool.func (task, pool->pool.user_data);
                  g_async_queue_lock (pool->queue);
                }
            }
@@ -170,7 +171,7 @@ g_thread_pool_thread_proxy (gpointer data)
 
          G_LOCK (unused_threads);
          if ((unused_threads >= max_unused_threads && 
-              max_unused_threads != -1) || pool->pool.stack_size != 0)
+              max_unused_threads != -1) || pool->stack_size != 0)
            {
              G_UNLOCK (unused_threads);
              g_async_queue_unlock (unused_queue);
@@ -234,7 +235,7 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
       GError *local_error = NULL;
       /* No thread was found, we have to start a new one */
       g_thread_create (g_thread_pool_thread_proxy, pool, 
-                      pool->pool.stack_size, FALSE, 
+                      pool->stack_size, FALSE, 
                       bound, priority, &local_error);
       
       if (local_error)
@@ -251,7 +252,9 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
 
 /**
  * g_thread_pool_new: 
- * @thread_func: a function to execute in the threads of the new thread pool
+ * @func: a function to execute in the threads of the new thread pool
+ * @user_data: user data that is handed over to @func every time it 
+ *   is called
  * @max_threads: the maximal number of threads to execute concurrently in 
  *   the new thread pool, -1 means no limit
  * @stack_size: the stack size for the threads of the new thread pool,
@@ -259,8 +262,6 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
  * @bound: should the threads of the new thread pool be bound?
  * @priority: a priority for the threads of the new thread pool
  * @exclusive: should this thread pool be exclusive?
- * @user_data: user data that is handed over to @thread_func every time it 
- *   is called
  * @error: return location for error
  *
  * This function creates a new thread pool. All threads created within
@@ -272,9 +273,9 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
  * created or an unused one is reused. At most @max_threads threads
  * are running concurrently for this thread pool. @max_threads = -1
  * allows unlimited threads to be created for this thread pool. The
- * newly created or reused thread now executes the function
- * @thread_func with the two arguments. The first one is the parameter
- * to g_thread_pool_push() and the second one is @user_data.
+ * newly created or reused thread now executes the function @func with
+ * the two arguments. The first one is the parameter to
+ * g_thread_pool_push() and the second one is @user_data.
  *
  * The parameter @exclusive determines, whether the thread pool owns
  * all threads exclusive or whether the threads are shared
@@ -298,31 +299,31 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
  * Return value: the new #GThreadPool
  **/
 GThreadPool* 
-g_thread_pool_new (GFunc            thread_func,
+g_thread_pool_new (GFunc            func,
+                  gpointer         user_data,
                   gint             max_threads,
                   gulong           stack_size,
                   gboolean         bound,
                   GThreadPriority  priority,
                   gboolean         exclusive,
-                  gpointer         user_data,
                   GError         **error)
 {
   GRealThreadPool *retval;
   G_LOCK_DEFINE_STATIC (init);
 
-  g_return_val_if_fail (thread_func, NULL);
+  g_return_val_if_fail (func, NULL);
   g_return_val_if_fail (!exclusive || max_threads != -1, NULL);
   g_return_val_if_fail (max_threads >= -1, NULL);
   g_return_val_if_fail (g_thread_supported (), NULL);
 
   retval = g_new (GRealThreadPool, 1);
 
-  retval->pool.thread_func = thread_func;
-  retval->pool.stack_size = stack_size;
+  retval->pool.func = func;
+  retval->pool.user_data = user_data;
   retval->pool.bound = bound;
   retval->pool.priority = priority;
   retval->pool.exclusive = exclusive;
-  retval->pool.user_data = user_data;
+  retval->stack_size = stack_size;
   retval->queue = g_async_queue_new ();
   retval->max_threads = max_threads;
   retval->num_threads = 0;
@@ -421,12 +422,11 @@ g_thread_pool_push (GThreadPool     *pool,
  * effectively frozen until @max_threads is set to a non-zero value
  * again.
  * 
- * A thread is never terminated while calling @thread_func, as
- * supplied by g_thread_pool_new (). Instead the maximal number of
- * threads only has effect for the allocation of new threads in
- * g_thread_pool_push (). A new thread is allocated, whenever the
- * number of currently running threads in @pool is smaller than the
- * maximal number.
+ * A thread is never terminated while calling @func, as supplied by
+ * g_thread_pool_new (). Instead the maximal number of threads only
+ * has effect for the allocation of new threads in g_thread_pool_push
+ * (). A new thread is allocated, whenever the number of currently
+ * running threads in @pool is smaller than the maximal number.
  *
  * @error can be NULL to ignore errors, or non-NULL to report
  * errors. An error can only occur, when a new thread couldn't be
index d6fa87c..245a1a0 100644 (file)
@@ -40,26 +40,25 @@ typedef struct _GThreadPool     GThreadPool;
  * pool with the constructor function */
 struct _GThreadPool
 {
-  GFunc thread_func;
-  gulong stack_size;
+  GFunc func;
+  gpointer user_data;
   gboolean bound;
   GThreadPriority priority;
   gboolean exclusive;
-  gpointer user_data;
 };
 
-/* Get a thread pool with the function thread_func, at most max_threads may
+/* Get a thread pool with the function func, at most max_threads may
  * run at a time (max_threads == -1 means no limit), stack_size, bound,
  * priority like in g_thread_create, exclusive == TRUE means, that the threads
  * shouldn't be shared and that they will be prestarted (otherwise they are
- * started, as needed) user_data is the 2nd argument to the thread_func */
-GThreadPool*    g_thread_pool_new             (GFunc            thread_func,
+ * started as needed) user_data is the 2nd argument to the func */
+GThreadPool*    g_thread_pool_new             (GFunc            func,
+                                               gpointer         user_data,
                                                gint             max_threads,
                                                gulong           stack_size,
                                                gboolean         bound,
                                                GThreadPriority  priority,
                                                gboolean         exclusive,
-                                               gpointer         user_data,
                                                GError         **error);
 
 /* Push new data into the thread pool. This task is assigned to a thread later
index e3b8a5b..635d9e8 100644 (file)
--- a/gthread.c
+++ b/gthread.c
@@ -535,14 +535,14 @@ g_thread_create_proxy (gpointer data)
     SET_PRIO (thread->pid, thread->thread.priority);
 #endif /* G_THREAD_USE_PID_SURROGATE */
 
-  thread->retval = thread->thread.func (thread->thread.arg);
+  thread->retval = thread->thread.func (thread->thread.data);
 
   return NULL;
 }
 
 GThread* 
-g_thread_create (GThreadFunc            thread_func,
-                gpointer                arg,
+g_thread_create (GThreadFunc            func,
+                gpointer                data,
                 gulong                  stack_size,
                 gboolean                joinable,
                 gboolean                bound,
@@ -551,15 +551,15 @@ g_thread_create (GThreadFunc               thread_func,
 {
   GRealThread* result = g_new (GRealThread, 1);
   GError *local_error = NULL;
-  g_return_val_if_fail (thread_func, NULL);
+  g_return_val_if_fail (func, NULL);
   g_return_val_if_fail (priority >= G_THREAD_PRIORITY_LOW, NULL);
   g_return_val_if_fail (priority <= G_THREAD_PRIORITY_URGENT, NULL);
   
   result->thread.joinable = joinable;
   result->thread.bound = bound;
   result->thread.priority = priority;
-  result->thread.func = thread_func;
-  result->thread.arg = arg;
+  result->thread.func = func;
+  result->thread.data = data;
   result->private_data = NULL; 
   result->context = NULL;
   G_LOCK (g_thread);
@@ -657,7 +657,7 @@ g_thread_self (void)
       thread->thread.priority = G_THREAD_PRIORITY_NORMAL; /* This is
                                                             just a guess */
       thread->thread.func = NULL;
-      thread->thread.arg = NULL;
+      thread->thread.data = NULL;
       thread->private_data = NULL;
       thread->context = NULL;
 
index 6a1bfba..4e2fcf3 100644 (file)
--- a/gthread.h
+++ b/gthread.h
@@ -43,7 +43,7 @@ typedef enum
   G_THREAD_ERROR_AGAIN /* Resource temporarily unavailable */
 } GThreadError;
 
-typedef gpointer (*GThreadFunc) (gpointer value);
+typedef gpointer (*GThreadFunc) (gpointer data);
 
 typedef enum
 {
@@ -56,11 +56,11 @@ typedef enum
 typedef struct _GThread         GThread;
 struct  _GThread
 {
+  GThreadFunc func;
+  gpointer data;
   gboolean joinable;
   gboolean bound;
   GThreadPriority priority;
-  GThreadFunc func;
-  gpointer arg;
 };
 
 typedef struct _GMutex          GMutex;
@@ -89,8 +89,8 @@ struct _GThreadFunctions
   gpointer  (*private_get)        (GPrivate             *private_key);
   void      (*private_set)        (GPrivate             *private_key,
                                    gpointer              data);
-  void      (*thread_create)      (GThreadFunc           thread_func,
-                                   gpointer              arg,
+  void      (*thread_create)      (GThreadFunc           func,
+                                   gpointer              data,
                                    gulong                stack_size,
                                    gboolean              joinable,
                                    gboolean              bound,
@@ -194,8 +194,8 @@ GMutex* g_static_mutex_get_mutex_impl   (GMutex **mutex);
                                                        (private_key, value))
 #define g_thread_yield()              G_THREAD_CF (thread_yield, (void)0, ())
 
-GThread* g_thread_create       (GThreadFunc            thread_func,
-                                gpointer               arg,
+GThread* g_thread_create       (GThreadFunc            func,
+                                gpointer               data,
                                 gulong                 stack_size,
                                 gboolean               joinable,
                                 gboolean               bound,
index 9cfba54..f97961a 100644 (file)
@@ -31,6 +31,7 @@ typedef struct _GRealThreadPool GRealThreadPool;
 struct _GRealThreadPool
 {
   GThreadPool pool;
+  gulong stack_size;
   GAsyncQueue* queue;
   gint max_threads;
   gint num_threads;
@@ -73,7 +74,7 @@ g_thread_pool_thread_proxy (gpointer data)
     {
       gpointer task; 
       gboolean goto_global_pool = 
-       !pool->pool.exclusive && pool->pool.stack_size == 0;
+       !pool->pool.exclusive && pool->stack_size == 0;
       gint len = g_async_queue_length_unlocked (pool->queue);
       
       if (g_thread_should_run (pool, len))
@@ -116,7 +117,7 @@ g_thread_pool_thread_proxy (gpointer data)
              else if (pool->running || !pool->immediate)
                {
                  g_async_queue_unlock (pool->queue);
-                 pool->pool.thread_func (task, pool->pool.user_data);
+                 pool->pool.func (task, pool->pool.user_data);
                  g_async_queue_lock (pool->queue);
                }
            }
@@ -170,7 +171,7 @@ g_thread_pool_thread_proxy (gpointer data)
 
          G_LOCK (unused_threads);
          if ((unused_threads >= max_unused_threads && 
-              max_unused_threads != -1) || pool->pool.stack_size != 0)
+              max_unused_threads != -1) || pool->stack_size != 0)
            {
              G_UNLOCK (unused_threads);
              g_async_queue_unlock (unused_queue);
@@ -234,7 +235,7 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
       GError *local_error = NULL;
       /* No thread was found, we have to start a new one */
       g_thread_create (g_thread_pool_thread_proxy, pool, 
-                      pool->pool.stack_size, FALSE, 
+                      pool->stack_size, FALSE, 
                       bound, priority, &local_error);
       
       if (local_error)
@@ -251,7 +252,9 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
 
 /**
  * g_thread_pool_new: 
- * @thread_func: a function to execute in the threads of the new thread pool
+ * @func: a function to execute in the threads of the new thread pool
+ * @user_data: user data that is handed over to @func every time it 
+ *   is called
  * @max_threads: the maximal number of threads to execute concurrently in 
  *   the new thread pool, -1 means no limit
  * @stack_size: the stack size for the threads of the new thread pool,
@@ -259,8 +262,6 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
  * @bound: should the threads of the new thread pool be bound?
  * @priority: a priority for the threads of the new thread pool
  * @exclusive: should this thread pool be exclusive?
- * @user_data: user data that is handed over to @thread_func every time it 
- *   is called
  * @error: return location for error
  *
  * This function creates a new thread pool. All threads created within
@@ -272,9 +273,9 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
  * created or an unused one is reused. At most @max_threads threads
  * are running concurrently for this thread pool. @max_threads = -1
  * allows unlimited threads to be created for this thread pool. The
- * newly created or reused thread now executes the function
- * @thread_func with the two arguments. The first one is the parameter
- * to g_thread_pool_push() and the second one is @user_data.
+ * newly created or reused thread now executes the function @func with
+ * the two arguments. The first one is the parameter to
+ * g_thread_pool_push() and the second one is @user_data.
  *
  * The parameter @exclusive determines, whether the thread pool owns
  * all threads exclusive or whether the threads are shared
@@ -298,31 +299,31 @@ g_thread_pool_start_thread (GRealThreadPool  *pool,
  * Return value: the new #GThreadPool
  **/
 GThreadPool* 
-g_thread_pool_new (GFunc            thread_func,
+g_thread_pool_new (GFunc            func,
+                  gpointer         user_data,
                   gint             max_threads,
                   gulong           stack_size,
                   gboolean         bound,
                   GThreadPriority  priority,
                   gboolean         exclusive,
-                  gpointer         user_data,
                   GError         **error)
 {
   GRealThreadPool *retval;
   G_LOCK_DEFINE_STATIC (init);
 
-  g_return_val_if_fail (thread_func, NULL);
+  g_return_val_if_fail (func, NULL);
   g_return_val_if_fail (!exclusive || max_threads != -1, NULL);
   g_return_val_if_fail (max_threads >= -1, NULL);
   g_return_val_if_fail (g_thread_supported (), NULL);
 
   retval = g_new (GRealThreadPool, 1);
 
-  retval->pool.thread_func = thread_func;
-  retval->pool.stack_size = stack_size;
+  retval->pool.func = func;
+  retval->pool.user_data = user_data;
   retval->pool.bound = bound;
   retval->pool.priority = priority;
   retval->pool.exclusive = exclusive;
-  retval->pool.user_data = user_data;
+  retval->stack_size = stack_size;
   retval->queue = g_async_queue_new ();
   retval->max_threads = max_threads;
   retval->num_threads = 0;
@@ -421,12 +422,11 @@ g_thread_pool_push (GThreadPool     *pool,
  * effectively frozen until @max_threads is set to a non-zero value
  * again.
  * 
- * A thread is never terminated while calling @thread_func, as
- * supplied by g_thread_pool_new (). Instead the maximal number of
- * threads only has effect for the allocation of new threads in
- * g_thread_pool_push (). A new thread is allocated, whenever the
- * number of currently running threads in @pool is smaller than the
- * maximal number.
+ * A thread is never terminated while calling @func, as supplied by
+ * g_thread_pool_new (). Instead the maximal number of threads only
+ * has effect for the allocation of new threads in g_thread_pool_push
+ * (). A new thread is allocated, whenever the number of currently
+ * running threads in @pool is smaller than the maximal number.
  *
  * @error can be NULL to ignore errors, or non-NULL to report
  * errors. An error can only occur, when a new thread couldn't be
index d6fa87c..245a1a0 100644 (file)
@@ -40,26 +40,25 @@ typedef struct _GThreadPool     GThreadPool;
  * pool with the constructor function */
 struct _GThreadPool
 {
-  GFunc thread_func;
-  gulong stack_size;
+  GFunc func;
+  gpointer user_data;
   gboolean bound;
   GThreadPriority priority;
   gboolean exclusive;
-  gpointer user_data;
 };
 
-/* Get a thread pool with the function thread_func, at most max_threads may
+/* Get a thread pool with the function func, at most max_threads may
  * run at a time (max_threads == -1 means no limit), stack_size, bound,
  * priority like in g_thread_create, exclusive == TRUE means, that the threads
  * shouldn't be shared and that they will be prestarted (otherwise they are
- * started, as needed) user_data is the 2nd argument to the thread_func */
-GThreadPool*    g_thread_pool_new             (GFunc            thread_func,
+ * started as needed) user_data is the 2nd argument to the func */
+GThreadPool*    g_thread_pool_new             (GFunc            func,
+                                               gpointer         user_data,
                                                gint             max_threads,
                                                gulong           stack_size,
                                                gboolean         bound,
                                                GThreadPriority  priority,
                                                gboolean         exclusive,
-                                               gpointer         user_data,
                                                GError         **error);
 
 /* Push new data into the thread pool. This task is assigned to a thread later