mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and g_thread_new_full(). Change the wording in the docs. Clarify expectations for (deprecated) g_thread_create().
This commit is contained in:
parent
b0e73ca390
commit
015f4b4513
@ -305,7 +305,6 @@ _g_dbus_shared_thread_ref (void)
|
||||
data->thread = g_thread_new ("gdbus",
|
||||
gdbus_shared_thread_func,
|
||||
data,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
/* We can cast between gsize and gpointer safely */
|
||||
|
@ -75,7 +75,7 @@ idle_start_test1_thread (gpointer loop)
|
||||
gboolean io_completed;
|
||||
|
||||
g_mutex_lock (&test1_mutex);
|
||||
thread = g_thread_new ("test1", test1_thread, NULL, TRUE, NULL);
|
||||
thread = g_thread_new ("test1", test1_thread, NULL, NULL);
|
||||
|
||||
g_get_current_time (&time);
|
||||
time.tv_sec += 2;
|
||||
|
@ -943,7 +943,6 @@ test_dispatch (const gchar *object_path)
|
||||
thread = g_thread_new ("test_dispatch",
|
||||
test_dispatch_thread_func,
|
||||
(gpointer) object_path,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread != NULL);
|
||||
|
@ -605,7 +605,6 @@ test_peer (void)
|
||||
service_thread = g_thread_new ("test_peer",
|
||||
service_thread_func,
|
||||
&data,
|
||||
TRUE,
|
||||
&error);
|
||||
while (service_loop == NULL)
|
||||
g_thread_yield ();
|
||||
@ -1055,7 +1054,6 @@ delayed_message_processing (void)
|
||||
service_thread = g_thread_new ("dmp",
|
||||
dmp_thread_func,
|
||||
data,
|
||||
TRUE,
|
||||
&error);
|
||||
while (data->server == NULL || !g_dbus_server_is_active (data->server))
|
||||
g_thread_yield ();
|
||||
@ -1204,7 +1202,6 @@ test_nonce_tcp (void)
|
||||
service_thread = g_thread_new ("nonce-tcp-service",
|
||||
nonce_tcp_service_thread_func,
|
||||
&data,
|
||||
TRUE,
|
||||
&error);
|
||||
while (service_loop == NULL)
|
||||
g_thread_yield ();
|
||||
@ -1514,7 +1511,6 @@ test_tcp_anonymous (void)
|
||||
service_thread = g_thread_new ("tcp-anon-service",
|
||||
tcp_anonymous_service_thread_func,
|
||||
&seen_connection, /* user_data */
|
||||
TRUE, /* joinable */
|
||||
&error);
|
||||
while (service_loop == NULL)
|
||||
g_thread_yield ();
|
||||
|
@ -222,7 +222,7 @@ test_proxy (void)
|
||||
for (i = 0; i < n_threads; i++)
|
||||
{
|
||||
proxy_threads[i] = g_thread_new ("run-proxy",
|
||||
run_proxy_thread, connection, TRUE,
|
||||
run_proxy_thread, connection,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
@ -568,7 +568,6 @@ on_name_acquired (GDBusConnection *connection,
|
||||
g_thread_new ("check-proxies",
|
||||
check_proxies_in_thread,
|
||||
loop,
|
||||
TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,6 @@ test_delivery_in_thread (void)
|
||||
thread = g_thread_new ("deliver",
|
||||
test_delivery_in_thread_func,
|
||||
NULL,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread != NULL);
|
||||
@ -398,7 +397,6 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
|
||||
thread1 = g_thread_new ("sleep",
|
||||
test_sleep_in_thread_func,
|
||||
&data1,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread1 != NULL);
|
||||
@ -411,7 +409,6 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
|
||||
thread2 = g_thread_new ("sleep2",
|
||||
test_sleep_in_thread_func,
|
||||
&data2,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread2 != NULL);
|
||||
@ -424,7 +421,6 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
|
||||
thread3 = g_thread_new ("sleep3",
|
||||
test_sleep_in_thread_func,
|
||||
&data3,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread3 != NULL);
|
||||
|
@ -201,7 +201,13 @@ start_sync_lookups (char **argv, int argc)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
g_thread_new ("lookup", lookup_thread, argv[i], FALSE, NULL);
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
thread = g_thread_new ("lookup", lookup_thread, argv[i], NULL);
|
||||
g_assert (thread != NULL);
|
||||
g_thread_unref (thread);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -90,8 +90,12 @@ main (int argc, char *argv[])
|
||||
|
||||
if (cancel_timeout)
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
cancellable = g_cancellable_new ();
|
||||
g_thread_new ("cancel", cancel_thread, cancellable, FALSE, NULL);
|
||||
thread = g_thread_new ("cancel", cancel_thread, cancellable, NULL);
|
||||
g_assert (thread != NULL);
|
||||
g_thread_unref (thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -288,8 +288,12 @@ main (int argc,
|
||||
|
||||
if (cancel_timeout)
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
cancellable = g_cancellable_new ();
|
||||
g_thread_new ("cancel", cancel_thread, cancellable, FALSE, NULL);
|
||||
thread = g_thread_new ("cancel", cancel_thread, cancellable, NULL);
|
||||
g_assert (thread != NULL);
|
||||
g_thread_unref (thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -81,8 +81,12 @@ main (int argc,
|
||||
|
||||
if (cancel_timeout)
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
cancellable = g_cancellable_new ();
|
||||
g_thread_new ("cancel", cancel_thread, cancellable, FALSE, NULL);
|
||||
thread = g_thread_new ("cancel", cancel_thread, cancellable, NULL);
|
||||
g_assert (thread != NULL);
|
||||
g_thread_unref (thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ create_server (GSocketFamily family,
|
||||
g_socket_listen (server, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
data->thread = g_thread_new ("server", server_thread, data, TRUE, &error);
|
||||
data->thread = g_thread_new ("server", server_thread, data, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
return data;
|
||||
|
@ -437,7 +437,7 @@ setup_with_thread_loop (Test *test,
|
||||
closure.test = test;
|
||||
|
||||
g_mutex_lock (&closure.loop_mutex);
|
||||
test->loop_thread = g_thread_new ("loop", thread_loop, &closure, TRUE, &error);
|
||||
test->loop_thread = g_thread_new ("loop", thread_loop, &closure, &error);
|
||||
while (!closure.started)
|
||||
g_cond_wait (&closure.loop_started, &closure.loop_mutex);
|
||||
g_mutex_unlock (&closure.loop_mutex);
|
||||
|
@ -216,8 +216,8 @@ test_pipe_io (void)
|
||||
reader_cancel = g_cancellable_new ();
|
||||
main_cancel = g_cancellable_new ();
|
||||
|
||||
writer = g_thread_new ("writer", writer_thread, NULL, TRUE, NULL);
|
||||
reader = g_thread_new ("reader", reader_thread, NULL, TRUE, NULL);
|
||||
writer = g_thread_new ("writer", writer_thread, NULL, NULL);
|
||||
reader = g_thread_new ("reader", reader_thread, NULL, NULL);
|
||||
|
||||
in = g_unix_input_stream_new (writer_pipe[0], TRUE);
|
||||
out = g_unix_output_stream_new (reader_pipe[1], TRUE);
|
||||
|
@ -312,16 +312,17 @@ g_deprecated_thread_proxy (gpointer data)
|
||||
*
|
||||
* This function creates a new thread.
|
||||
*
|
||||
* If @joinable is %TRUE, you can wait for this threads termination
|
||||
* calling g_thread_join(). Otherwise the thread will just disappear
|
||||
* when it terminates.
|
||||
*
|
||||
* The new thread executes the function @func with the argument @data.
|
||||
* If the thread was created successfully, it is returned.
|
||||
*
|
||||
* @error can be %NULL to ignore errors, or non-%NULL to report errors.
|
||||
* The error is set, if and only if the function returns %NULL.
|
||||
*
|
||||
* This function returns a reference to the created thread only if
|
||||
* @joinable is %TRUE. In that case, you must free this reference by
|
||||
* calling g_thread_unref() or g_thread_join(). If @joinable is %FALSE
|
||||
* then you should probably not touch the return value.
|
||||
*
|
||||
* Returns: the new #GThread on success
|
||||
*
|
||||
* Deprecated:2.32: Use g_thread_new() instead
|
||||
@ -332,7 +333,7 @@ g_thread_create (GThreadFunc func,
|
||||
gboolean joinable,
|
||||
GError **error)
|
||||
{
|
||||
return g_thread_new_internal (NULL, g_deprecated_thread_proxy, func, data, joinable, 0, error);
|
||||
return g_thread_create_full (func, data, 0, joinable, 0, 0, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -360,11 +361,20 @@ g_thread_create_full (GThreadFunc func,
|
||||
GThreadPriority priority,
|
||||
GError **error)
|
||||
{
|
||||
return g_thread_new_internal (NULL, g_deprecated_thread_proxy, func, data, joinable, stack_size, error);
|
||||
GThread *thread;
|
||||
|
||||
thread = g_thread_new_internal (NULL, g_deprecated_thread_proxy,
|
||||
func, data, stack_size, error);
|
||||
|
||||
if (!joinable)
|
||||
{
|
||||
thread->joinable = FALSE;
|
||||
g_thread_unref (thread);
|
||||
}
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* GOnce {{{1 ------------------------------------------------------------- */
|
||||
gboolean
|
||||
g_once_init_enter_impl (volatile gsize *location)
|
||||
|
@ -4760,7 +4760,7 @@ g_get_worker_context (void)
|
||||
GError *error = NULL;
|
||||
|
||||
glib_worker_context = g_main_context_new ();
|
||||
if (g_thread_new ("gmain", glib_worker_main, NULL, FALSE, &error) == NULL)
|
||||
if (g_thread_new ("gmain", glib_worker_main, NULL, &error) == NULL)
|
||||
g_error ("Creating GLib worker thread failed: %s\n", error->message);
|
||||
|
||||
g_once_init_leave (&initialised, TRUE);
|
||||
|
@ -427,10 +427,6 @@
|
||||
* Specifies the type of the @func functions passed to
|
||||
* g_thread_new() or g_thread_new_full().
|
||||
*
|
||||
* If the thread is joinable, the return value of this function
|
||||
* is returned by a g_thread_join() call waiting for the thread.
|
||||
* If the thread is not joinable, the return value is ignored.
|
||||
*
|
||||
* Returns: the return value of the thread
|
||||
*/
|
||||
|
||||
@ -725,7 +721,6 @@ g_thread_proxy (gpointer data)
|
||||
* @name: a name for the new thread
|
||||
* @func: a function to execute in the new thread
|
||||
* @data: an argument to supply to the new thread
|
||||
* @joinable: should this thread be joinable?
|
||||
* @error: return location for error
|
||||
*
|
||||
* This function creates a new thread. The new thread starts by invoking
|
||||
@ -736,14 +731,11 @@ g_thread_proxy (gpointer data)
|
||||
* a debugger. Some systems restrict the length of @name to
|
||||
* 16 bytes.
|
||||
*
|
||||
* If @joinable is %TRUE, you can wait for this thread's termination
|
||||
* calling g_thread_join(). Resources for a joinable thread are not
|
||||
* fully released until g_thread_join() is called for that thread.
|
||||
* Otherwise the thread will just disappear when it terminates.
|
||||
*
|
||||
* @error can be %NULL to ignore errors, or non-%NULL to report errors.
|
||||
* The error is set, if and only if the function returns %NULL.
|
||||
*
|
||||
* You must
|
||||
*
|
||||
* Returns: the new #GThread, or %NULL if an error occurred
|
||||
*
|
||||
* Since: 2.32
|
||||
@ -752,10 +744,9 @@ GThread *
|
||||
g_thread_new (const gchar *name,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gboolean joinable,
|
||||
GError **error)
|
||||
{
|
||||
return g_thread_new_internal (name, g_thread_proxy, func, data, joinable, 0, error);
|
||||
return g_thread_new_internal (name, g_thread_proxy, func, data, 0, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -763,7 +754,6 @@ g_thread_new (const gchar *name,
|
||||
* @name: a name for the new thread
|
||||
* @func: a function to execute in the new thread
|
||||
* @data: an argument to supply to the new thread
|
||||
* @joinable: should this thread be joinable?
|
||||
* @stack_size: a stack size for the new thread
|
||||
* @error: return location for error
|
||||
*
|
||||
@ -782,11 +772,6 @@ g_thread_new (const gchar *name,
|
||||
* In most cases, using g_thread_new() (which doesn't take a
|
||||
* @stack_size) is better.
|
||||
*
|
||||
* If @joinable is %TRUE, you can wait for this thread's termination
|
||||
* calling g_thread_join(). Resources for a joinable thread are not
|
||||
* fully released until g_thread_join() is called for that thread.
|
||||
* Otherwise the thread will just disappear when it terminates.
|
||||
*
|
||||
* @error can be %NULL to ignore errors, or non-%NULL to report errors.
|
||||
* The error is set, if and only if the function returns %NULL.
|
||||
*
|
||||
@ -798,11 +783,10 @@ GThread *
|
||||
g_thread_new_full (const gchar *name,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gboolean joinable,
|
||||
gsize stack_size,
|
||||
GError **error)
|
||||
{
|
||||
return g_thread_new_internal (name, g_thread_proxy, func, data, joinable, stack_size, error);
|
||||
return g_thread_new_internal (name, g_thread_proxy, func, data, stack_size, error);
|
||||
}
|
||||
|
||||
GThread *
|
||||
@ -810,7 +794,6 @@ g_thread_new_internal (const gchar *name,
|
||||
GThreadFunc proxy,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gboolean joinable,
|
||||
gsize stack_size,
|
||||
GError **error)
|
||||
{
|
||||
@ -822,9 +805,9 @@ g_thread_new_internal (const gchar *name,
|
||||
thread = g_system_thread_new (proxy, stack_size, error);
|
||||
if (thread)
|
||||
{
|
||||
thread->ref_count = joinable ? 2 : 1;
|
||||
thread->ref_count = 2;
|
||||
thread->ours = TRUE;
|
||||
thread->thread.joinable = joinable;
|
||||
thread->thread.joinable = TRUE;
|
||||
thread->thread.func = func;
|
||||
thread->thread.data = data;
|
||||
thread->name = name;
|
||||
@ -840,10 +823,9 @@ g_thread_new_internal (const gchar *name,
|
||||
*
|
||||
* Terminates the current thread.
|
||||
*
|
||||
* If another thread is waiting for that thread using g_thread_join()
|
||||
* and the current thread is joinable, the waiting thread will be woken
|
||||
* up and get @retval as the return value of g_thread_join(). If the
|
||||
* current thread is not joinable, @retval is ignored.
|
||||
* If another thread is waiting for us using g_thread_join() then the
|
||||
* waiting thread will be woken up and get @retval as the return value
|
||||
* of g_thread_join().
|
||||
*
|
||||
* Calling <literal>g_thread_exit (retval)</literal> is equivalent to
|
||||
* returning @retval from the function @func, as given to g_thread_new().
|
||||
@ -863,17 +845,16 @@ g_thread_exit (gpointer retval)
|
||||
|
||||
/**
|
||||
* g_thread_join:
|
||||
* @thread: a joinable #GThread
|
||||
* @thread: a #GThread
|
||||
*
|
||||
* Waits until @thread finishes, i.e. the function @func, as
|
||||
* given to g_thread_new(), returns or g_thread_exit() is called.
|
||||
* If @thread has already terminated, then g_thread_join()
|
||||
* returns immediately. @thread must be joinable.
|
||||
* returns immediately.
|
||||
*
|
||||
* Any thread can wait for any other (joinable) thread by calling
|
||||
* g_thread_join(), not just its 'creator'. Calling g_thread_join()
|
||||
* from multiple threads for the same @thread leads to undefined
|
||||
* behaviour.
|
||||
* Any thread can wait for any other thread by calling g_thread_join(),
|
||||
* not just its 'creator'. Calling g_thread_join() from multiple threads
|
||||
* for the same @thread leads to undefined behaviour.
|
||||
*
|
||||
* The value returned by @func or given to g_thread_exit() is
|
||||
* returned by this function.
|
||||
@ -890,7 +871,6 @@ g_thread_join (GThread *thread)
|
||||
gpointer retval;
|
||||
|
||||
g_return_val_if_fail (thread, NULL);
|
||||
g_return_val_if_fail (thread->joinable, NULL);
|
||||
|
||||
g_system_thread_wait (real);
|
||||
|
||||
|
@ -142,12 +142,10 @@ void g_thread_unref (GThread *thread);
|
||||
GThread * g_thread_new (const gchar *name,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gboolean joinable,
|
||||
GError **error);
|
||||
GThread * g_thread_new_full (const gchar *name,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gboolean joinable,
|
||||
gsize stack_size,
|
||||
GError **error);
|
||||
GThread * g_thread_self (void);
|
||||
|
@ -411,14 +411,15 @@ g_thread_pool_start_thread (GRealThreadPool *pool,
|
||||
|
||||
if (!success)
|
||||
{
|
||||
GError *local_error = NULL;
|
||||
GThread *thread;
|
||||
|
||||
/* No thread was found, we have to start a new one */
|
||||
if (!g_thread_new ("pool", g_thread_pool_thread_proxy, pool, FALSE, &local_error))
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
return FALSE;
|
||||
}
|
||||
thread = g_thread_new ("pool", g_thread_pool_thread_proxy, pool, error);
|
||||
|
||||
if (thread == NULL)
|
||||
return FALSE;
|
||||
|
||||
g_thread_unref (thread);
|
||||
}
|
||||
|
||||
/* See comment in g_thread_pool_thread_proxy as to why this is done
|
||||
|
@ -44,13 +44,13 @@ void g_system_thread_free (GRealThread *thread);
|
||||
G_GNUC_INTERNAL void g_system_thread_exit (void);
|
||||
G_GNUC_INTERNAL void g_system_thread_set_name (const gchar *name);
|
||||
|
||||
G_GNUC_INTERNAL GThread *g_thread_new_internal (const gchar *name,
|
||||
GThreadFunc proxy,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gboolean joinable,
|
||||
gsize stack_size,
|
||||
GError **error);
|
||||
G_GNUC_INTERNAL
|
||||
GThread * g_thread_new_internal (const gchar *name,
|
||||
GThreadFunc proxy,
|
||||
GThreadFunc func,
|
||||
gpointer data,
|
||||
gsize stack_size,
|
||||
GError **error);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gpointer g_thread_proxy (gpointer thread);
|
||||
|
@ -104,7 +104,7 @@ test_once3 (void)
|
||||
shared = 0;
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
threads[i] = g_thread_new ("once3", thread_func, NULL, TRUE, NULL);
|
||||
threads[i] = g_thread_new ("once3", thread_func, NULL, 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, TRUE, &error);
|
||||
thread = g_thread_new ("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, TRUE, NULL);
|
||||
thread = g_thread_new ("test", thread2_func, NULL, NULL);
|
||||
|
||||
g_assert (g_thread_self () != thread);
|
||||
|
||||
@ -107,9 +107,9 @@ test_thread3 (void)
|
||||
gpointer result;
|
||||
GThread *thread1, *thread2, *thread3;
|
||||
|
||||
thread1 = g_thread_new_full ("a", thread3_func, NULL, TRUE, 0, NULL);
|
||||
thread2 = g_thread_new_full ("b", thread3_func, thread1, TRUE, 100, NULL);
|
||||
thread3 = g_thread_new_full ("c", thread3_func, thread2, TRUE, 100000, NULL);
|
||||
thread1 = g_thread_new_full ("a", thread3_func, NULL, 0, NULL);
|
||||
thread2 = g_thread_new_full ("b", thread3_func, thread1, 100, NULL);
|
||||
thread3 = g_thread_new_full ("c", thread3_func, thread2, 100000, NULL);
|
||||
|
||||
result = g_thread_join (thread3);
|
||||
|
||||
@ -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, FALSE, &error);
|
||||
thread = g_thread_new ("a", thread1_func, NULL, &error);
|
||||
g_assert (thread == NULL);
|
||||
g_assert_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN);
|
||||
g_error_free (error);
|
||||
|
@ -210,7 +210,7 @@ test_multithreaded_dynamic_type_init (void)
|
||||
|
||||
/* create threads */
|
||||
for (i = 0; i < N_THREADS; i++) {
|
||||
threads[i] = g_thread_new ("test", ref_unref_thread, (gpointer) DYNAMIC_OBJECT_TYPE, TRUE, NULL);
|
||||
threads[i] = g_thread_new ("test", ref_unref_thread, (gpointer) DYNAMIC_OBJECT_TYPE, NULL);
|
||||
}
|
||||
|
||||
/* execute threads */
|
||||
|
@ -133,8 +133,8 @@ testcase (gconstpointer data)
|
||||
|
||||
for (i = 0; i < THREADS; i++)
|
||||
threads[i] = g_thread_new ("foo", thread_func,
|
||||
GINT_TO_POINTER (use_pointers),
|
||||
TRUE, NULL);
|
||||
GINT_TO_POINTER (use_pointers),
|
||||
NULL);
|
||||
|
||||
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), TRUE, NULL);
|
||||
threads[i] = g_thread_new ("atomic", thread_func, GINT_TO_POINTER (i), NULL);
|
||||
|
||||
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], TRUE, NULL);
|
||||
threads[i] = g_thread_new ("test", thread_func, &contexts[i], NULL);
|
||||
}
|
||||
|
||||
/* dispatch tokens */
|
||||
|
@ -41,8 +41,7 @@ multithreaded_test_run (GThreadFunc function)
|
||||
{
|
||||
GThread *thread;
|
||||
|
||||
thread = g_thread_new ("test", function,
|
||||
GINT_TO_POINTER (i), TRUE, &error);
|
||||
thread = g_thread_new ("test", function, GINT_TO_POINTER (i), &error);
|
||||
g_assert_no_error (error);
|
||||
g_ptr_array_add (threads, thread);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user