mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Improve threadpool test coverage
This commit is contained in:
parent
a946892b1e
commit
373dcaea56
@ -340,13 +340,15 @@ test_thread_idle_time ()
|
|||||||
|
|
||||||
idle_pool = g_thread_pool_new (test_thread_idle_time_entry_func,
|
idle_pool = g_thread_pool_new (test_thread_idle_time_entry_func,
|
||||||
NULL,
|
NULL,
|
||||||
MAX_THREADS,
|
0,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
g_thread_pool_set_max_threads (idle_pool, MAX_THREADS, NULL);
|
||||||
g_thread_pool_set_max_unused_threads (MAX_UNUSED_THREADS);
|
g_thread_pool_set_max_unused_threads (MAX_UNUSED_THREADS);
|
||||||
g_thread_pool_set_max_idle_time (interval);
|
g_thread_pool_set_max_idle_time (interval);
|
||||||
|
|
||||||
|
g_assert (g_thread_pool_get_max_threads (idle_pool) == MAX_THREADS);
|
||||||
g_assert (g_thread_pool_get_max_unused_threads () == MAX_UNUSED_THREADS);
|
g_assert (g_thread_pool_get_max_unused_threads () == MAX_UNUSED_THREADS);
|
||||||
g_assert (g_thread_pool_get_max_idle_time () == interval);
|
g_assert (g_thread_pool_get_max_idle_time () == interval);
|
||||||
|
|
||||||
@ -359,6 +361,8 @@ test_thread_idle_time ()
|
|||||||
g_thread_pool_unprocessed (idle_pool)));
|
g_thread_pool_unprocessed (idle_pool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert_cmpint (g_thread_pool_unprocessed (idle_pool), <=, limit);
|
||||||
|
|
||||||
g_timeout_add ((interval - 1000),
|
g_timeout_add ((interval - 1000),
|
||||||
test_thread_idle_timeout,
|
test_thread_idle_timeout,
|
||||||
GUINT_TO_POINTER (interval));
|
GUINT_TO_POINTER (interval));
|
||||||
|
Loading…
Reference in New Issue
Block a user