mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-25 18:39:00 +02:00
g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure. Introduce g_thread_try() for those who want to handle failure.
This commit is contained in:
@@ -133,8 +133,7 @@ testcase (gconstpointer data)
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
threads[i] = g_thread_new ("foo", thread_func,
|
||||
GINT_TO_POINTER (use_pointers),
|
||||
NULL);
|
||||
GINT_TO_POINTER (use_pointers));
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
g_thread_join (threads[i]);
|
||||
|
@@ -47,7 +47,7 @@ test_atomic (void)
|
||||
bucket[i] = 0;
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
threads[i] = g_thread_new ("atomic", thread_func, GINT_TO_POINTER (i), NULL);
|
||||
threads[i] = g_thread_new ("atomic", thread_func, GINT_TO_POINTER (i));
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
g_thread_join (threads[i]);
|
||||
|
@@ -229,7 +229,7 @@ test_threaded (void)
|
||||
for (i = 0; i < NUM_THREADS; i++)
|
||||
{
|
||||
context_init (&contexts[i]);
|
||||
threads[i] = g_thread_new ("test", thread_func, &contexts[i], NULL);
|
||||
threads[i] = g_thread_new ("test", thread_func, &contexts[i]);
|
||||
}
|
||||
|
||||
/* dispatch tokens */
|
||||
|
@@ -34,18 +34,16 @@ static void
|
||||
multithreaded_test_run (GThreadFunc function)
|
||||
{
|
||||
int i;
|
||||
GError *error = NULL;
|
||||
GPtrArray *threads = g_ptr_array_new ();
|
||||
|
||||
for (i = 0; i < N_THREADS; i++)
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
thread = g_thread_new ("test", function, GINT_TO_POINTER (i), &error);
|
||||
g_assert_no_error (error);
|
||||
thread = g_thread_new ("test", function, GINT_TO_POINTER (i));
|
||||
g_ptr_array_add (threads, thread);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < N_THREADS; i++)
|
||||
{
|
||||
gpointer ret;
|
||||
|
Reference in New Issue
Block a user