Deprecate g_thread_create_full()
authorRyan Lortie <desrt@desrt.ca>
Mon, 19 Sep 2011 04:45:19 +0000 (00:45 -0400)
committerRyan Lortie <desrt@desrt.ca>
Wed, 21 Sep 2011 20:06:55 +0000 (16:06 -0400)
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).

docs/reference/glib/glib-sections.txt
glib/glib.symbols
glib/gthread.c
glib/gthread.h
tests/slice-test.c

index dcc8347..8f5fa13 100644 (file)
@@ -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
index 7116518..32bf8c6 100644 (file)
@@ -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
index 74181e0..06b1956 100644 (file)
@@ -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.
  *
- * <note><para>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.</para></note>
+ * <note><para>
+ *   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.
+ * </para></note>
  **/
 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.
  *
index e45613e..a1c9c3d 100644 (file)
@@ -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);
index a118ce6..84eb872 100644 (file)
@@ -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]);