diff options
author | Martyn James Russell <mr@src.gnome.org> | 2006-04-07 09:23:42 +0000 |
---|---|---|
committer | Martyn James Russell <mr@src.gnome.org> | 2006-04-07 09:23:42 +0000 |
commit | 6c6f17133dbdd47cfa7b6567e6a669bb210b55a2 (patch) | |
tree | 590087e088b403ce4ea185afc2abad19d5f226ba /glib/gasyncqueue.h | |
parent | 49cc2e2396a6f5cc554d6ebcdf37682942e0c4d8 (diff) | |
download | glib-6c6f17133dbdd47cfa7b6567e6a669bb210b55a2.tar.gz |
Make sure g_thread_pool_stop_unused_threads() actually stops unused
* glib/gthreadpool.c: Make sure
g_thread_pool_stop_unused_threads() actually stops unused threads
and global limits (like max idle time and max unused threads) can
be set without creating a thread pool first. Fixed #335215 (patch
from Chris Wilson).
* tests/threadpool-test.c: Added two new tests, tests setting
global limits before creating a thread pool. The second test
makes sure unused threads are actually stopped when using the
g_thread_pool_stop_unused_threads().
Diffstat (limited to 'glib/gasyncqueue.h')
-rw-r--r-- | glib/gasyncqueue.h | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/glib/gasyncqueue.h b/glib/gasyncqueue.h index ce11e15ad..413093f3c 100644 --- a/glib/gasyncqueue.h +++ b/glib/gasyncqueue.h @@ -31,13 +31,12 @@ G_BEGIN_DECLS -typedef struct _GAsyncQueue GAsyncQueue; +typedef struct _GAsyncQueue GAsyncQueue; -/* Asyncronous Queues, can be used to communicate between threads - */ +/* Asyncronous Queues, can be used to communicate between threads */ /* Get a new GAsyncQueue with the ref_count 1 */ -GAsyncQueue* g_async_queue_new (void); +GAsyncQueue* g_async_queue_new (void); /* Lock and unlock a GAsyncQueue. All functions lock the queue for * themselves, but in certain cirumstances you want to hold the lock longer, @@ -46,19 +45,14 @@ GAsyncQueue* g_async_queue_new (void); void g_async_queue_lock (GAsyncQueue *queue); void g_async_queue_unlock (GAsyncQueue *queue); - - /* Ref and unref the GAsyncQueue. */ GAsyncQueue* g_async_queue_ref (GAsyncQueue *queue); void g_async_queue_unref (GAsyncQueue *queue); - #ifndef G_DISABLE_DEPRECATED /* You don't have to hold the lock for calling *_ref and *_unref anymore. */ void g_async_queue_ref_unlocked (GAsyncQueue *queue); void g_async_queue_unref_and_unlock (GAsyncQueue *queue); - - #endif /* !G_DISABLE_DEPRECATED */ /* Push data into the async queue. Must not be NULL. */ @@ -77,12 +71,11 @@ void g_async_queue_push_sorted_unlocked (GAsyncQueue *queue, gpointer user_data); /* Pop data from the async queue. When no data is there, the thread is blocked - * until data arrives. */ + * until data arrives. + */ gpointer g_async_queue_pop (GAsyncQueue *queue); gpointer g_async_queue_pop_unlocked (GAsyncQueue *queue); - - /* Try to pop data. NULL is returned in case of empty queue. */ gpointer g_async_queue_try_pop (GAsyncQueue *queue); gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue); @@ -90,20 +83,20 @@ gpointer g_async_queue_try_pop_unlocked (GAsyncQueue *queue); /* Wait for data until at maximum until end_time is reached. NULL is returned - * in case of empty queue. */ + * in case of empty queue. + */ gpointer g_async_queue_timed_pop (GAsyncQueue *queue, GTimeVal *end_time); gpointer g_async_queue_timed_pop_unlocked (GAsyncQueue *queue, GTimeVal *end_time); - - /* Return the length of the queue. Negative values mean that threads * are waiting, positve values mean that there are entries in the * queue. Actually this function returns the length of the queue minus * the number of waiting threads, g_async_queue_length == 0 could also * mean 'n' entries in the queue and 'n' thread waiting. Such can - * happen due to locking of the queue or due to scheduling. */ + * happen due to locking of the queue or due to scheduling. + */ gint g_async_queue_length (GAsyncQueue *queue); gint g_async_queue_length_unlocked (GAsyncQueue *queue); void g_async_queue_sort (GAsyncQueue *queue, @@ -113,6 +106,8 @@ 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 |