[glib] GAsyncQueue: Move private API to a private header
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GAsyncQueue: Move private API to a private header
- Date: Sun, 2 Oct 2011 00:23:32 +0000 (UTC)
commit 93abf20d3bc17fcf14cfb605b2142113dc1fd8e9
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 1 18:42:48 2011 -0400
GAsyncQueue: Move private API to a private header
glib/Makefile.am | 5 +++--
glib/gasyncqueue.c | 1 +
glib/gasyncqueue.h | 3 ---
glib/gasyncqueueprivate.h | 31 +++++++++++++++++++++++++++++++
glib/gthreadpool.c | 23 +++++++++++++----------
5 files changed, 48 insertions(+), 15 deletions(-)
---
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 74bf060..c96e2a2 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -122,6 +122,7 @@ libglib_2_0_la_SOURCES = \
glib_probes.d \
garray.c \
gasyncqueue.c \
+ gasyncqueueprivate.h \
gatomic.c \
gbacktrace.c \
gbase64.c \
@@ -178,9 +179,9 @@ libglib_2_0_la_SOURCES = \
gstrfuncs.c \
gstring.c \
gtestutils.c \
- gthread.c \
+ gthread.c \
gthreadprivate.h \
- gthreadpool.c \
+ gthreadpool.c \
gtimer.c \
gtimezone.c \
gtree.c \
diff --git a/glib/gasyncqueue.c b/glib/gasyncqueue.c
index 308c0cd..0128795 100644
--- a/glib/gasyncqueue.c
+++ b/glib/gasyncqueue.c
@@ -27,6 +27,7 @@
#include "config.h"
#include "gasyncqueue.h"
+#include "gasyncqueueprivate.h"
#include "gmem.h"
#include "gqueue.h"
diff --git a/glib/gasyncqueue.h b/glib/gasyncqueue.h
index 9da43e3..15dab99 100644
--- a/glib/gasyncqueue.h
+++ b/glib/gasyncqueue.h
@@ -112,9 +112,6 @@ void g_async_queue_sort_unlocked (GAsyncQueue *queue,
GCompareDataFunc func,
gpointer user_data);
-/* Private API */
-GMutex* _g_async_queue_get_mutex (GAsyncQueue *queue);
-
G_END_DECLS
#endif /* __G_ASYNCQUEUE_H__ */
diff --git a/glib/gasyncqueueprivate.h b/glib/gasyncqueueprivate.h
new file mode 100644
index 0000000..3ecb29a
--- /dev/null
+++ b/glib/gasyncqueueprivate.h
@@ -0,0 +1,31 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __G_ASYNCQUEUEPRIVATE_H__
+#define __G_ASYNCQUEUEPRIVATE_H__
+
+#include "gasyncqueue.h"
+
+G_BEGIN_DECLS
+
+GMutex *_g_async_queue_get_mutex (GAsyncQueue *queue);
+
+G_END_DECLS
+
+#endif /* __G_ASYNCQUEUEPRIVATE_H__ */
diff --git a/glib/gthreadpool.c b/glib/gthreadpool.c
index 9f5dc82..56356d2 100644
--- a/glib/gthreadpool.c
+++ b/glib/gthreadpool.c
@@ -29,6 +29,7 @@
#include "gthreadpool.h"
#include "gasyncqueue.h"
+#include "gasyncqueueprivate.h"
#include "gmain.h"
#include "gtestutils.h"
#include "gtimer.h"
@@ -88,7 +89,7 @@ typedef struct _GRealThreadPool GRealThreadPool;
struct _GRealThreadPool
{
GThreadPool pool;
- GAsyncQueue* queue;
+ GAsyncQueue *queue;
GCond *cond;
gint max_threads;
gint num_threads;
@@ -175,8 +176,7 @@ g_thread_pool_wait_for_new_pool (void)
else
{
/* If no maximal idle time is given, wait indefinitely. */
- DEBUG_MSG (("thread %p waiting in global pool.",
- g_thread_self ()));
+ DEBUG_MSG (("thread %p waiting in global pool.", g_thread_self ()));
pool = g_async_queue_pop (unused_thread_queue);
}
@@ -489,6 +489,8 @@ g_thread_pool_new (GFunc func,
retval->max_threads = max_threads;
retval->num_threads = 0;
retval->running = TRUE;
+ retval->immediate = FALSE;
+ retval->waiting = FALSE;
retval->sort_func = NULL;
retval->sort_user_data = NULL;
@@ -524,12 +526,13 @@ g_thread_pool_new (GFunc func,
* @data: a new task for @pool
* @error: return location for error, or %NULL
*
- * Inserts @data into the list of tasks to be executed by @pool. When
- * the number of currently running threads is lower than the maximal
- * allowed number of threads, a new thread is started (or reused) with
- * the properties given to g_thread_pool_new (). Otherwise @data stays
- * in the queue until a thread in this pool finishes its previous task
- * and processes @data.
+ * Inserts @data into the list of tasks to be executed by @pool.
+ *
+ * When the number of currently running threads is lower than the
+ * maximal allowed number of threads, a new thread is started (or
+ * reused) with the properties given to g_thread_pool_new().
+ * Otherwise, @data stays in the queue until a thread in this pool
+ * finishes its previous task and processes @data.
*
* @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
@@ -735,7 +738,7 @@ g_thread_pool_unprocessed (GThreadPool *pool)
*
* If @immediate is %TRUE, no new task is processed for @pool.
* Otherwise @pool is not freed before the last task is processed.
- * Note however, that no thread of this pool is interrupted, while
+ * Note however, that no thread of this pool is interrupted while
* processing a task. Instead at least all still running threads
* can finish their tasks before the @pool is freed.
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]