summaryrefslogtreecommitdiff
path: root/tests/threadpool-test.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-07-20 17:06:02 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-07-20 17:06:02 +0000
commit8ac11176ab38858bb14b47881a2ef7ed1ed0c7c7 (patch)
tree5976176db41833f63aa3f7d82cb12dc461199c7f /tests/threadpool-test.c
parente81747cdc09f1f72a42b7c4088417224f7f36417 (diff)
downloadglib-8ac11176ab38858bb14b47881a2ef7ed1ed0c7c7.tar.gz
Don't get stuck in here if immediate is TRUE. (#310954, Hong Jen Yee)
2005-07-20 Matthias Clasen <mclasen@redhat.com> * glib/gthreadpool.c (g_thread_pool_free): Don't get stuck in here if immediate is TRUE. (#310954, Hong Jen Yee) * tests/threadpool-test.c (main): Test immediate == TRUE.
Diffstat (limited to 'tests/threadpool-test.c')
-rw-r--r--tests/threadpool-test.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/threadpool-test.c b/tests/threadpool-test.c
index 477484008..95993e8f5 100644
--- a/tests/threadpool-test.c
+++ b/tests/threadpool-test.c
@@ -8,6 +8,7 @@
G_LOCK_DEFINE_STATIC (thread_counter);
gulong abs_thread_counter;
gulong running_thread_counter;
+gulong leftover_task_counter;
void
thread_pool_func (gpointer a, gpointer b)
@@ -21,6 +22,7 @@ thread_pool_func (gpointer a, gpointer b)
G_LOCK (thread_counter);
running_thread_counter--;
+ leftover_task_counter--;
G_UNLOCK (thread_counter);
}
@@ -44,13 +46,14 @@ main (int argc,
g_thread_pool_push (pool1, GUINT_TO_POINTER (1), NULL);
g_thread_pool_push (pool2, GUINT_TO_POINTER (1), NULL);
g_thread_pool_push (pool3, GUINT_TO_POINTER (1), NULL);
+ leftover_task_counter += 3;
}
- g_thread_pool_free (pool1, FALSE, TRUE);
+ g_thread_pool_free (pool1, TRUE, TRUE);
g_thread_pool_free (pool2, FALSE, TRUE);
g_thread_pool_free (pool3, FALSE, TRUE);
- g_assert (RUNS * 3 == abs_thread_counter);
+ g_assert (RUNS * 3 == abs_thread_counter + leftover_task_counter);
g_assert (running_thread_counter == 0);
#endif
return 0;