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().
This commit is contained in:
Martyn James Russell
2006-04-07 09:23:42 +00:00
parent 49cc2e2396
commit 6c6f17133d
6 changed files with 473 additions and 281 deletions

View File

@@ -625,5 +625,18 @@ g_async_queue_sort_unlocked (GAsyncQueue *queue,
&sd);
}
/*
* Private API
*/
GMutex*
_g_async_queue_get_mutex (GAsyncQueue* queue)
{
g_return_val_if_fail (queue, NULL);
g_return_val_if_fail (g_atomic_int_get (&queue->ref_count) > 0, NULL);
return queue->mutex;
}
#define __G_ASYNCQUEUE_C__
#include "galiasdef.c"