drop g_thread_new_full()

We'll hold out on this until someone has a really convincing reason for
why they need to control the stack size.

If we do decide to add it back, it should probably have a name like
_new_with_stack_size(), not _full().
This commit is contained in:
Ryan Lortie 2011-10-13 01:17:36 -04:00
parent 430c5635f2
commit 332f74a2fc
6 changed files with 10 additions and 57 deletions

View File

@ -350,7 +350,7 @@ g_thread_create (GThreadFunc func,
* This function creates a new thread. * This function creates a new thread.
* *
* Deprecated:2.32: The @bound and @priority arguments are now ignored. * Deprecated:2.32: The @bound and @priority arguments are now ignored.
* Use g_thread_new() or g_thread_new_full() instead. * Use g_thread_new().
*/ */
GThread * GThread *
g_thread_create_full (GThreadFunc func, g_thread_create_full (GThreadFunc func,

View File

@ -102,7 +102,7 @@ GThread *g_thread_create (GThreadFunc func,
gboolean joinable, gboolean joinable,
GError **error); GError **error);
GLIB_DEPRECATED_FOR(g_thread_new_full) GLIB_DEPRECATED_FOR(g_thread_new)
GThread *g_thread_create_full (GThreadFunc func, GThread *g_thread_create_full (GThreadFunc func,
gpointer data, gpointer data,
gulong stack_size, gulong stack_size,

View File

@ -1099,7 +1099,6 @@ g_thread_functions_for_glib_use
g_thread_init_glib g_thread_init_glib
g_thread_join g_thread_join
g_thread_new g_thread_new
g_thread_new_full
g_thread_ref g_thread_ref
g_thread_self g_thread_self
g_thread_set_priority g_thread_set_priority

View File

@ -412,9 +412,9 @@
* GThread: * GThread:
* *
* The #GThread struct represents a running thread. This struct * The #GThread struct represents a running thread. This struct
* is returned by g_thread_new() or g_thread_new_full(). You can * is returned by g_thread_new() or g_thread_try(). You can obtain the
* obtain the #GThread struct representing the current thead by * #GThread struct representing the current thead by calling
* calling g_thread_self(). * g_thread_self().
* *
* The structure is opaque -- none of its fields may be directly * The structure is opaque -- none of its fields may be directly
* accessed. * accessed.
@ -424,8 +424,8 @@
* GThreadFunc: * GThreadFunc:
* @data: data passed to the thread * @data: data passed to the thread
* *
* Specifies the type of the @func functions passed to * Specifies the type of the @func functions passed to g_thread_new() or
* g_thread_new() or g_thread_new_full(). * g_thread_try().
* *
* Returns: the return value of the thread * Returns: the return value of the thread
*/ */
@ -780,47 +780,6 @@ g_thread_try (const gchar *name,
return g_thread_new_internal (name, g_thread_proxy, func, data, 0, error); return g_thread_new_internal (name, g_thread_proxy, func, data, 0, error);
} }
/**
* g_thread_new_full:
* @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
* @stack_size: a stack size for the new thread
* @error: return location for error
*
* This function creates a new thread. The new thread starts by
* invoking @func with the argument data. The thread will run
* until @func returns or until g_thread_exit() is called.
*
* The @name can be useful for discriminating threads in
* a debugger. Some systems restrict the length of @name to
* 16 bytes.
*
* If the underlying thread implementation supports it, the thread
* gets a stack size of @stack_size or the default value for the
* current platform, if @stack_size is 0. Note that you should only
* use a non-zero @stack_size if you really can't use the default.
* In most cases, using g_thread_new() (which doesn't take a
* @stack_size) is better.
*
* @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.
*
* Returns: the new #GThread, or %NULL if an error occurred
*
* Since: 2.32
*/
GThread *
g_thread_new_full (const gchar *name,
GThreadFunc func,
gpointer data,
gsize stack_size,
GError **error)
{
return g_thread_new_internal (name, g_thread_proxy, func, data, stack_size, error);
}
GThread * GThread *
g_thread_new_internal (const gchar *name, g_thread_new_internal (const gchar *name,
GThreadFunc proxy, GThreadFunc proxy,

View File

@ -146,11 +146,6 @@ GThread * g_thread_try (const gchar *name,
GThreadFunc func, GThreadFunc func,
gpointer data, gpointer data,
GError **error); GError **error);
GThread * g_thread_new_full (const gchar *name,
GThreadFunc func,
gpointer data,
gsize stack_size,
GError **error);
GThread * g_thread_self (void); GThread * g_thread_self (void);
void g_thread_exit (gpointer retval); void g_thread_exit (gpointer retval);
gpointer g_thread_join (GThread *thread); gpointer g_thread_join (GThread *thread);

View File

@ -107,9 +107,9 @@ test_thread3 (void)
gpointer result; gpointer result;
GThread *thread1, *thread2, *thread3; GThread *thread1, *thread2, *thread3;
thread1 = g_thread_new_full ("a", thread3_func, NULL, 0, NULL); thread1 = g_thread_new ("a", thread3_func, NULL);
thread2 = g_thread_new_full ("b", thread3_func, thread1, 100, NULL); thread2 = g_thread_new ("b", thread3_func, thread1);
thread3 = g_thread_new_full ("c", thread3_func, thread2, 100000, NULL); thread3 = g_thread_new ("c", thread3_func, thread2);
result = g_thread_join (thread3); result = g_thread_join (thread3);