From: Ryan Lortie Date: Mon, 19 Sep 2011 04:45:19 +0000 (-0400) Subject: Deprecate g_thread_create_full() X-Git-Tag: 2.31.0~417 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14e6377a603abd03a3c9d7130da1c1113cec4d7b;hp=9621b1093e7b745e6f8184012bc3c18ab1d261b1;p=platform%2Fupstream%2Fglib.git Deprecate g_thread_create_full() Replace it with g_thread_create_with_stack_size() and a real function implementation of g_thread_create(). Modify a testcase that was calling g_thread_create_full() inappropriately (it was using the default values anyway). --- diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index dcc8347..8f5fa13 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -595,6 +595,7 @@ GThreadFunc GThreadPriority GThread g_thread_create +g_thread_create_with_stack_size g_thread_create_full g_thread_self g_thread_join diff --git a/glib/glib.symbols b/glib/glib.symbols index 7116518..32bf8c6 100644 --- a/glib/glib.symbols +++ b/glib/glib.symbols @@ -1092,6 +1092,8 @@ g_thread_functions_for_glib_use g_threads_got_initialized g_thread_use_default_impl g_thread_gettime +g_thread_create +g_thread_create_with_stack_size g_thread_create_full g_thread_error_quark g_thread_exit diff --git a/glib/gthread.c b/glib/gthread.c index 74181e0..06b1956 100644 --- a/glib/gthread.c +++ b/glib/gthread.c @@ -1669,15 +1669,21 @@ g_thread_create_proxy (gpointer data) * * Returns: the new #GThread on success */ +GThread * +g_thread_create (GThreadFunc func, + gpointer data, + gboolean joinable, + GError **error) +{ + return g_thread_create_with_stack_size (func, data, joinable, 0, error); +} /** - * g_thread_create_full: + * g_thread_create_with_stack_size: * @func: a function to execute in the new thread. * @data: an argument to supply to the new thread. - * @stack_size: a stack size for the new thread. * @joinable: should this thread be joinable? - * @bound: ignored - * @priority: ignored + * @stack_size: a stack size for the new thread. * @error: return location for error. * @Returns: the new #GThread on success. * @@ -1696,19 +1702,19 @@ g_thread_create_proxy (gpointer data) * @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. * - * Only use g_thread_create_full() if you really can't use - * g_thread_create() instead. g_thread_create() does not take - * @stack_size, @bound, and @priority as arguments, as they should only - * be used in cases in which it is unavoidable. + * + * Only use g_thread_create_with_stack_size() if you really can't use + * g_thread_create() instead. g_thread_create() does not take + * @stack_size, as it should only be used in cases in which it is + * unavoidable. + * **/ GThread* -g_thread_create_full (GThreadFunc func, - gpointer data, - gulong stack_size, - gboolean joinable, - gboolean bound, - GThreadPriority priority, - GError **error) +g_thread_create_with_stack_size (GThreadFunc func, + gpointer data, + gboolean joinable, + gsize stack_size, + GError **error) { GRealThread* result; GError *local_error = NULL; @@ -1742,6 +1748,34 @@ g_thread_create_full (GThreadFunc func, } /** + * g_thread_create_full: + * @func: a function to execute in the new thread. + * @data: an argument to supply to the new thread. + * @stack_size: a stack size for the new thread. + * @joinable: should this thread be joinable? + * @bound: ignored + * @priority: ignored + * @error: return location for error. + * @Returns: the new #GThread on success. + * + * This function creates a new thread. + * + * Deprecated:2.32: The @bound and @priority arguments are now ignored. + * Use g_thread_create() or g_thread_create_with_stack_size() instead. + **/ +GThread * +g_thread_create_full (GThreadFunc func, + gpointer data, + gulong stack_size, + gboolean joinable, + gboolean bound, + GThreadPriority priority, + GError **error) +{ + return g_thread_create_with_stack_size (func, data, joinable, stack_size, error); +} + +/** * g_thread_exit: * @retval: the return value of this thread. * diff --git a/glib/gthread.h b/glib/gthread.h index e45613e..a1c9c3d 100644 --- a/glib/gthread.h +++ b/glib/gthread.h @@ -174,9 +174,7 @@ GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex); #define g_thread_supported() (g_threads_got_initialized) #endif -#define g_thread_create(func, data, joinable, error) \ - (g_thread_create_full (func, data, 0, joinable, FALSE, 0, error)) - +#ifndef G_DISABLE_DEPRECATED GThread* g_thread_create_full (GThreadFunc func, gpointer data, gulong stack_size, @@ -184,6 +182,19 @@ GThread* g_thread_create_full (GThreadFunc func, gboolean bound, GThreadPriority priority, GError **error); +#endif + +GThread * g_thread_create (GThreadFunc func, + gpointer data, + gboolean joinable, + GError **error); + +GThread * g_thread_create_with_stack_size (GThreadFunc func, + gpointer data, + gboolean joinable, + gsize stack_size, + GError **error); + GThread* g_thread_self (void); void g_thread_exit (gpointer retval); gpointer g_thread_join (GThread *thread); diff --git a/tests/slice-test.c b/tests/slice-test.c index a118ce6..84eb872 100644 --- a/tests/slice-test.c +++ b/tests/slice-test.c @@ -282,12 +282,12 @@ main (int argc, threads = g_alloca (sizeof(GThread*) * n_threads); if (!use_memchunks) for (i = 0; i < n_threads; i++) - threads[i] = g_thread_create_full (test_sliced_mem_thread, seedp, 0, TRUE, FALSE, 0, NULL); + threads[i] = g_thread_create (test_sliced_mem_thread, seedp, TRUE, NULL); else { old_mem_chunks_init(); for (i = 0; i < n_threads; i++) - threads[i] = g_thread_create_full (test_memchunk_thread, seedp, 0, TRUE, FALSE, 0, NULL); + threads[i] = g_thread_create (test_memchunk_thread, seedp, TRUE, NULL); } for (i = 0; i < n_threads; i++) g_thread_join (threads[i]);