From 7ca83c6c9f369a88df98a86810596bb9efc73736 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 5 Oct 2011 11:45:51 -0400 Subject: [PATCH] Fix up some doc comments that referred to threads not being enabled (and a few other unrelated comment fixes) --- gio/gasyncresult.c | 6 ------ gio/gioscheduler.c | 2 +- gio/giotypes.h | 6 +----- gio/gresolver.c | 3 +-- gio/gsimpleasyncresult.c | 2 +- gio/gsocketservice.c | 12 +++++++----- glib/glib-unix.c | 6 ------ glib/gmain.c | 2 +- glib/gthreadpool.c | 2 +- 9 files changed, 13 insertions(+), 28 deletions(-) diff --git a/gio/gasyncresult.c b/gio/gasyncresult.c index b23b456d5..adf6f9c26 100644 --- a/gio/gasyncresult.c +++ b/gio/gasyncresult.c @@ -102,12 +102,6 @@ * The callback for an asynchronous operation is called only once, and is * always called, even in the case of a cancelled operation. On cancellation * the result is a %G_IO_ERROR_CANCELLED error. - * - * Some asynchronous operations are implemented using synchronous calls. - * These are run in a separate thread, if #GThread has been initialized, but - * otherwise they are sent to the Main Event Loop and processed in an idle - * function. So, if you truly need asynchronous operations, make sure to - * initialize #GThread. **/ typedef GAsyncResultIface GAsyncResultInterface; diff --git a/gio/gioscheduler.c b/gio/gioscheduler.c index e75e3308d..6e669c781 100644 --- a/gio/gioscheduler.c +++ b/gio/gioscheduler.c @@ -194,7 +194,7 @@ io_job_thread (gpointer data, * of the request. * @cancellable: optional #GCancellable object, %NULL to ignore. * - * Schedules the I/O job to run. + * Schedules the I/O job to run in another thread. * * @notify will be called on @user_data after @job_func has returned, * regardless whether the job was cancelled or has run to completion. diff --git a/gio/giotypes.h b/gio/giotypes.h index e34164db3..d37bcefc5 100644 --- a/gio/giotypes.h +++ b/gio/giotypes.h @@ -196,7 +196,7 @@ typedef struct _GTcpWrapperConnection GTcpWrapperConnectio /** * GThreadedSocketService: * - * A helper class for handling accepting incomming connections in the + * A helper class for handling accepting incoming connections in the * glib mainloop and handling them in a thread. * * Since: 2.22 @@ -286,10 +286,6 @@ typedef gboolean (* GFileReadMoreCallback) (const char *file_contents, * * I/O Job function. * - * Note that depending on whether threads are available, the - * #GIOScheduler may run jobs in separate threads or in an idle - * in the mainloop. - * * Long-running jobs should periodically check the @cancellable * to see if they have been cancelled. * diff --git a/gio/gresolver.c b/gio/gresolver.c index 433b23d97..ad069745b 100644 --- a/gio/gresolver.c +++ b/gio/gresolver.c @@ -139,8 +139,7 @@ static GResolver *default_resolver; * * Gets the default #GResolver. You should unref it when you are done * with it. #GResolver may use its reference count as a hint about how - * many threads/processes, etc it should allocate for concurrent DNS - * resolutions. + * many threads it should allocate for concurrent DNS resolutions. * * Return value: (transfer full): the default #GResolver. * diff --git a/gio/gsimpleasyncresult.c b/gio/gsimpleasyncresult.c index ddffef109..389d3c147 100644 --- a/gio/gsimpleasyncresult.c +++ b/gio/gsimpleasyncresult.c @@ -88,7 +88,7 @@ * cause a leak if cancelled before being run). * * GSimpleAsyncResult can integrate into GLib's event loop, #GMainLoop, - * or it can use #GThreads if available. + * or it can use #GThreads. * g_simple_async_result_complete() will finish an I/O task directly * from the point where it is called. g_simple_async_result_complete_in_idle() * will finish it from an idle handler in the thread-default + * context of the thread it is created in, and is not + * threadsafe in general. However, the calls to start and stop the + * service are thread-safe so these can be used from threads that * handle incoming clients. * * Since: 2.22 @@ -172,7 +174,7 @@ g_socket_service_is_active (GSocketService *service) * Starts the service, i.e. start accepting connections * from the added sockets when the mainloop runs. * - * This call is threadsafe, so it may be called from a thread + * This call is thread-safe, so it may be called from a thread * handling an incoming client request. * * Since: 2.22 @@ -202,7 +204,7 @@ g_socket_service_start (GSocketService *service) * Stops the service, i.e. stops accepting connections * from the added sockets when the mainloop runs. * - * This call is threadsafe, so it may be called from a thread + * This call is thread-safe, so it may be called from a thread * handling an incoming client request. * * Since: 2.22 diff --git a/glib/glib-unix.c b/glib/glib-unix.c index 2654f0e5d..838d1e233 100644 --- a/glib/glib-unix.c +++ b/glib/glib-unix.c @@ -200,12 +200,6 @@ g_unix_set_fd_nonblocking (gint fd, * The interaction of this source when combined with native UNIX * functions like sigprocmask() is not defined. * - * For reliable behavior, if your program links to gthread - * (either directly or indirectly via GObject, GIO, or a higher level - * library), you should ensure g_thread_init() is called before using - * this function. For example, if your program uses GObject, call - * g_type_init(). - * * The source will not initially be associated with any #GMainContext * and must be added to one with g_source_attach() before it will be * executed. diff --git a/glib/gmain.c b/glib/gmain.c index 6c31a5d71..fe63b40e0 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -723,7 +723,7 @@ g_main_context_pop_thread_default (GMainContext *context) * add their #GSources to. (Note that even in single-threaded * programs applications may sometimes want to temporarily push a * non-default context, so it is not safe to assume that this will - * always return %NULL if threads are not initialized.) + * always return %NULL if you are running in the default thread.) * * Returns: (transfer none): the thread-default #GMainContext, or * %NULL if the thread-default context is the global default context. diff --git a/glib/gthreadpool.c b/glib/gthreadpool.c index 28d609fb0..0e2340e9c 100644 --- a/glib/gthreadpool.c +++ b/glib/gthreadpool.c @@ -1,7 +1,7 @@ /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * - * GAsyncQueue: thread pool implementation. + * GThreadPool: thread pool implementation. * Copyright (C) 2000 Sebastian Wilhelmi; University of Karlsruhe * * This library is free software; you can redistribute it and/or -- 2.34.1