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