mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-16 10:22:52 +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:
@@ -104,7 +104,7 @@ test_once3 (void)
|
||||
shared = 0;
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
threads[i] = g_thread_new ("once3", thread_func, NULL, NULL);
|
||||
threads[i] = g_thread_new ("once3", thread_func, NULL);
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
g_thread_join (threads[i]);
|
||||
|
@@ -50,7 +50,7 @@ test_thread1 (void)
|
||||
GThread *thread;
|
||||
GError *error = NULL;
|
||||
|
||||
thread = g_thread_new ("test", thread1_func, NULL, &error);
|
||||
thread = g_thread_try ("test", thread1_func, NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
result = g_thread_join (thread);
|
||||
@@ -71,7 +71,7 @@ test_thread2 (void)
|
||||
gpointer result;
|
||||
GThread *thread;
|
||||
|
||||
thread = g_thread_new ("test", thread2_func, NULL, NULL);
|
||||
thread = g_thread_new ("test", thread2_func, NULL);
|
||||
|
||||
g_assert (g_thread_self () != thread);
|
||||
|
||||
@@ -135,7 +135,7 @@ test_thread4 (void)
|
||||
g_error ("prlimit failed: %s\n", g_strerror (ret));
|
||||
|
||||
error = NULL;
|
||||
thread = g_thread_new ("a", thread1_func, NULL, &error);
|
||||
thread = g_thread_try ("a", thread1_func, NULL, &error);
|
||||
g_assert (thread == NULL);
|
||||
g_assert_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN);
|
||||
g_error_free (error);
|
||||
|
Reference in New Issue
Block a user