mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 15:06:14 +01:00
Don't use deprecated GThread API in gio tests
This commit is contained in:
parent
5662619f22
commit
93e49aea1b
@ -248,7 +248,6 @@ main (int argc,
|
||||
SetupData *data;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
|
@ -75,7 +75,7 @@ idle_start_test1_thread (gpointer loop)
|
||||
gboolean io_completed;
|
||||
|
||||
g_mutex_lock (&test1_mutex);
|
||||
thread = g_thread_create (test1_thread, NULL, TRUE, NULL);
|
||||
thread = g_thread_new ("test1", test1_thread, NULL, TRUE, NULL);
|
||||
|
||||
g_get_current_time (&time);
|
||||
time.tv_sec += 2;
|
||||
@ -179,7 +179,6 @@ main (int argc, char **argv)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
g_thread_init (NULL);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
|
@ -43,7 +43,6 @@ main (int argc, char *argv[])
|
||||
GError *error = NULL;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
|
||||
context = g_option_context_new (" - Test GSocket server stuff");
|
||||
g_option_context_add_main_entries (context, cmd_entries, NULL);
|
||||
|
@ -114,7 +114,6 @@ main (int argc,
|
||||
gint ret;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
/* all the tests rely on a shared main loop */
|
||||
|
@ -940,10 +940,11 @@ test_dispatch (const gchar *object_path)
|
||||
|
||||
/* run this in a thread to avoid deadlocks */
|
||||
error = NULL;
|
||||
thread = g_thread_create (test_dispatch_thread_func,
|
||||
(gpointer) object_path,
|
||||
TRUE,
|
||||
&error);
|
||||
thread = g_thread_new ("test_dispatch",
|
||||
test_dispatch_thread_func,
|
||||
(gpointer) object_path,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread != NULL);
|
||||
g_main_loop_run (loop);
|
||||
|
@ -341,7 +341,6 @@ main (int argc,
|
||||
gint ret;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
/* all the tests rely on a shared main loop */
|
||||
|
@ -602,10 +602,11 @@ test_peer (void)
|
||||
|
||||
/* bring up a server - we run the server in a different thread to avoid deadlocks */
|
||||
error = NULL;
|
||||
service_thread = g_thread_create (service_thread_func,
|
||||
&data,
|
||||
TRUE,
|
||||
&error);
|
||||
service_thread = g_thread_new ("test_peer",
|
||||
service_thread_func,
|
||||
&data,
|
||||
TRUE,
|
||||
&error);
|
||||
while (service_loop == NULL)
|
||||
g_thread_yield ();
|
||||
g_assert (server != NULL);
|
||||
@ -1051,10 +1052,11 @@ delayed_message_processing (void)
|
||||
data = g_new0 (DmpData, 1);
|
||||
|
||||
error = NULL;
|
||||
service_thread = g_thread_create (dmp_thread_func,
|
||||
data,
|
||||
TRUE,
|
||||
&error);
|
||||
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 ();
|
||||
|
||||
@ -1199,10 +1201,11 @@ test_nonce_tcp (void)
|
||||
error = NULL;
|
||||
server = NULL;
|
||||
service_loop = NULL;
|
||||
service_thread = g_thread_create (nonce_tcp_service_thread_func,
|
||||
&data,
|
||||
TRUE,
|
||||
&error);
|
||||
service_thread = g_thread_new ("nonce-tcp-service",
|
||||
nonce_tcp_service_thread_func,
|
||||
&data,
|
||||
TRUE,
|
||||
&error);
|
||||
while (service_loop == NULL)
|
||||
g_thread_yield ();
|
||||
g_assert (server != NULL);
|
||||
@ -1508,10 +1511,11 @@ test_tcp_anonymous (void)
|
||||
|
||||
seen_connection = FALSE;
|
||||
service_loop = NULL;
|
||||
service_thread = g_thread_create (tcp_anonymous_service_thread_func,
|
||||
&seen_connection, /* user_data */
|
||||
TRUE, /* joinable */
|
||||
&error);
|
||||
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 ();
|
||||
g_assert (server != NULL);
|
||||
@ -1549,7 +1553,6 @@ main (int argc,
|
||||
gchar *tmpdir = NULL;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
|
||||
|
@ -221,8 +221,9 @@ test_proxy (void)
|
||||
|
||||
for (i = 0; i < n_threads; i++)
|
||||
{
|
||||
proxy_threads[i] = g_thread_create (run_proxy_thread, connection, TRUE,
|
||||
&error);
|
||||
proxy_threads[i] = g_thread_new ("run-proxy",
|
||||
run_proxy_thread, connection, TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
|
@ -565,10 +565,11 @@ on_name_acquired (GDBusConnection *connection,
|
||||
{
|
||||
GMainLoop *loop = user_data;
|
||||
|
||||
g_thread_create (check_proxies_in_thread,
|
||||
loop,
|
||||
TRUE,
|
||||
NULL);
|
||||
g_thread_new ("check-proxies",
|
||||
check_proxies_in_thread,
|
||||
loop,
|
||||
TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -233,10 +233,11 @@ test_delivery_in_thread (void)
|
||||
GThread *thread;
|
||||
|
||||
error = NULL;
|
||||
thread = g_thread_create (test_delivery_in_thread_func,
|
||||
NULL,
|
||||
TRUE,
|
||||
&error);
|
||||
thread = g_thread_new ("deliver",
|
||||
test_delivery_in_thread_func,
|
||||
NULL,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread != NULL);
|
||||
|
||||
@ -394,10 +395,11 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
|
||||
data1.num = 100;
|
||||
data1.async = do_async;
|
||||
data1.done = FALSE;
|
||||
thread1 = g_thread_create (test_sleep_in_thread_func,
|
||||
&data1,
|
||||
TRUE,
|
||||
&error);
|
||||
thread1 = g_thread_new ("sleep",
|
||||
test_sleep_in_thread_func,
|
||||
&data1,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread1 != NULL);
|
||||
|
||||
@ -406,10 +408,11 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
|
||||
data2.num = 200;
|
||||
data2.async = do_async;
|
||||
data2.done = FALSE;
|
||||
thread2 = g_thread_create (test_sleep_in_thread_func,
|
||||
&data2,
|
||||
TRUE,
|
||||
&error);
|
||||
thread2 = g_thread_new ("sleep2",
|
||||
test_sleep_in_thread_func,
|
||||
&data2,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread2 != NULL);
|
||||
|
||||
@ -418,10 +421,11 @@ test_method_calls_on_proxy (GDBusProxy *proxy)
|
||||
data3.num = 40;
|
||||
data3.async = do_async;
|
||||
data3.done = FALSE;
|
||||
thread3 = g_thread_create (test_sleep_in_thread_func,
|
||||
&data3,
|
||||
TRUE,
|
||||
&error);
|
||||
thread3 = g_thread_new ("sleep3",
|
||||
test_sleep_in_thread_func,
|
||||
&data3,
|
||||
TRUE,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (thread3 != NULL);
|
||||
|
||||
@ -494,7 +498,6 @@ main (int argc,
|
||||
gint ret;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
/* all the tests rely on a shared main loop */
|
||||
|
@ -147,7 +147,6 @@ main (int argc, char *argv[])
|
||||
GError *error = NULL;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
|
||||
context = g_option_context_new ("<http root dir> - Simple HTTP server");
|
||||
g_option_context_add_main_entries (context, cmd_entries, NULL);
|
||||
|
@ -201,7 +201,7 @@ start_sync_lookups (char **argv, int argc)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
g_thread_create (lookup_thread, argv[i], FALSE, NULL);
|
||||
g_thread_new ("lookup", lookup_thread, argv[i], FALSE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -70,7 +70,6 @@ main (int argc, char *argv[])
|
||||
char buffer[1000];
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
|
||||
context = g_option_context_new (" <hostname>[:port] - send data to tcp host");
|
||||
g_option_context_add_main_entries (context, cmd_entries, NULL);
|
||||
@ -92,7 +91,7 @@ main (int argc, char *argv[])
|
||||
if (cancel_timeout)
|
||||
{
|
||||
cancellable = g_cancellable_new ();
|
||||
g_thread_create (cancel_thread, cancellable, FALSE, NULL);
|
||||
g_thread_new ("cancel", cancel_thread, cancellable, FALSE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -261,8 +261,6 @@ main (int argc,
|
||||
GTlsCertificate *certificate = NULL;
|
||||
gint i;
|
||||
|
||||
g_thread_init (NULL);
|
||||
|
||||
g_type_init ();
|
||||
|
||||
address = NULL;
|
||||
@ -291,7 +289,7 @@ main (int argc,
|
||||
if (cancel_timeout)
|
||||
{
|
||||
cancellable = g_cancellable_new ();
|
||||
g_thread_create (cancel_thread, cancellable, FALSE, NULL);
|
||||
g_thread_new ("cancel", cancel_thread, cancellable, FALSE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -63,8 +63,6 @@ main (int argc,
|
||||
GInputStream *istream;
|
||||
GOutputStream *ostream;
|
||||
|
||||
g_thread_init (NULL);
|
||||
|
||||
g_type_init ();
|
||||
|
||||
context = g_option_context_new (" - Test GSocket server stuff");
|
||||
@ -84,7 +82,7 @@ main (int argc,
|
||||
if (cancel_timeout)
|
||||
{
|
||||
cancellable = g_cancellable_new ();
|
||||
g_thread_create (cancel_thread, cancellable, FALSE, NULL);
|
||||
g_thread_new ("cancel", cancel_thread, cancellable, FALSE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ create_server (GSocketFamily family,
|
||||
g_socket_listen (server, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
data->thread = g_thread_create (server_thread, data, TRUE, &error);
|
||||
data->thread = g_thread_new ("server", server_thread, data, TRUE, &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_create (thread_loop, &closure, TRUE, &error);
|
||||
test->loop_thread = g_thread_new ("loop", thread_loop, &closure, TRUE, &error);
|
||||
while (!closure.started)
|
||||
g_cond_wait (&closure.loop_started, &closure.loop_mutex);
|
||||
g_mutex_unlock (&closure.loop_mutex);
|
||||
@ -606,7 +606,6 @@ main (int argc,
|
||||
gint ret;
|
||||
|
||||
g_type_init ();
|
||||
g_thread_init (NULL);
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
fixtures = g_ptr_array_new_with_free_func (g_free);
|
||||
|
@ -216,8 +216,8 @@ test_pipe_io (void)
|
||||
reader_cancel = g_cancellable_new ();
|
||||
main_cancel = g_cancellable_new ();
|
||||
|
||||
writer = g_thread_create (writer_thread, NULL, TRUE, NULL);
|
||||
reader = g_thread_create (reader_thread, NULL, TRUE, NULL);
|
||||
writer = g_thread_new ("writer", writer_thread, NULL, TRUE, NULL);
|
||||
reader = g_thread_new ("reader", reader_thread, NULL, TRUE, NULL);
|
||||
|
||||
in = g_unix_input_stream_new (writer_pipe[0], TRUE);
|
||||
out = g_unix_output_stream_new (reader_pipe[1], TRUE);
|
||||
@ -246,7 +246,6 @@ int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
g_thread_init (NULL);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
|
@ -236,8 +236,8 @@ test_pipe_io (void)
|
||||
reader_cancel = g_cancellable_new ();
|
||||
main_cancel = g_cancellable_new ();
|
||||
|
||||
writer = g_thread_create (writer_thread, NULL, TRUE, NULL);
|
||||
reader = g_thread_create (reader_thread, NULL, TRUE, NULL);
|
||||
writer = g_thread_new ("writer", writer_thread, NULL, TRUE, NULL);
|
||||
reader = g_thread_new ("reader", reader_thread, NULL, TRUE, NULL);
|
||||
|
||||
g_assert (DuplicateHandle (GetCurrentProcess (),
|
||||
(HANDLE) (gintptr) _get_osfhandle (writer_pipe[0]),
|
||||
@ -282,7 +282,6 @@ int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
g_thread_init (NULL);
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user