mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
gmain: Clarify thread safety of some common GSource functions
See https://stackoverflow.com/q/58555626/2931197. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
d515a1e85a
commit
ca4dace62b
18
glib/gmain.c
18
glib/gmain.c
@ -115,8 +115,10 @@
|
|||||||
*
|
*
|
||||||
* To allow multiple independent sets of sources to be handled in
|
* To allow multiple independent sets of sources to be handled in
|
||||||
* different threads, each source is associated with a #GMainContext.
|
* different threads, each source is associated with a #GMainContext.
|
||||||
* A GMainContext can only be running in a single thread, but
|
* A #GMainContext can only be running in a single thread, but
|
||||||
* sources can be added to it and removed from it from other threads.
|
* sources can be added to it and removed from it from other threads. All
|
||||||
|
* functions which operate on a #GMainContext or a built-in #GSource are
|
||||||
|
* thread-safe.
|
||||||
*
|
*
|
||||||
* Each event source is assigned a priority. The default priority,
|
* Each event source is assigned a priority. The default priority,
|
||||||
* #G_PRIORITY_DEFAULT, is 0. Values less than 0 denote higher priorities.
|
* #G_PRIORITY_DEFAULT, is 0. Values less than 0 denote higher priorities.
|
||||||
@ -1171,6 +1173,9 @@ g_source_attach_unlocked (GSource *source,
|
|||||||
* Adds a #GSource to a @context so that it will be executed within
|
* Adds a #GSource to a @context so that it will be executed within
|
||||||
* that context. Remove it by calling g_source_destroy().
|
* that context. Remove it by calling g_source_destroy().
|
||||||
*
|
*
|
||||||
|
* This function is safe to call from any thread, regardless of which thread
|
||||||
|
* the @context is running in.
|
||||||
|
*
|
||||||
* Returns: the ID (greater than 0) for the source within the
|
* Returns: the ID (greater than 0) for the source within the
|
||||||
* #GMainContext.
|
* #GMainContext.
|
||||||
**/
|
**/
|
||||||
@ -1267,6 +1272,9 @@ g_source_destroy_internal (GSource *source,
|
|||||||
*
|
*
|
||||||
* This does not unref the #GSource: if you still hold a reference, use
|
* This does not unref the #GSource: if you still hold a reference, use
|
||||||
* g_source_unref() to drop it.
|
* g_source_unref() to drop it.
|
||||||
|
*
|
||||||
|
* This function is safe to call from any thread, regardless of which thread
|
||||||
|
* the #GMainContext is running in.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
g_source_destroy (GSource *source)
|
g_source_destroy (GSource *source)
|
||||||
@ -4832,6 +4840,8 @@ g_timeout_add_full (gint priority,
|
|||||||
* context. You can do these steps manually if you need greater control or to
|
* context. You can do these steps manually if you need greater control or to
|
||||||
* use a custom main context.
|
* use a custom main context.
|
||||||
*
|
*
|
||||||
|
* It is safe to call this function from any thread.
|
||||||
|
*
|
||||||
* The interval given is in terms of monotonic time, not wall clock
|
* The interval given is in terms of monotonic time, not wall clock
|
||||||
* time. See g_get_monotonic_time().
|
* time. See g_get_monotonic_time().
|
||||||
*
|
*
|
||||||
@ -4889,6 +4899,8 @@ g_timeout_add (guint32 interval,
|
|||||||
* using g_source_attach(). You can do these steps manually if you need
|
* using g_source_attach(). You can do these steps manually if you need
|
||||||
* greater control.
|
* greater control.
|
||||||
*
|
*
|
||||||
|
* It is safe to call this function from any thread.
|
||||||
|
*
|
||||||
* The interval given is in terms of monotonic time, not wall clock
|
* The interval given is in terms of monotonic time, not wall clock
|
||||||
* time. See g_get_monotonic_time().
|
* time. See g_get_monotonic_time().
|
||||||
*
|
*
|
||||||
@ -4936,6 +4948,8 @@ g_timeout_add_seconds_full (gint priority,
|
|||||||
* using g_source_attach(). You can do these steps manually if you need
|
* using g_source_attach(). You can do these steps manually if you need
|
||||||
* greater control. Also see g_timeout_add_seconds_full().
|
* greater control. Also see g_timeout_add_seconds_full().
|
||||||
*
|
*
|
||||||
|
* It is safe to call this function from any thread.
|
||||||
|
*
|
||||||
* Note that the first call of the timer may not be precise for timeouts
|
* Note that the first call of the timer may not be precise for timeouts
|
||||||
* of one second. If you need finer precision and have such a timeout,
|
* of one second. If you need finer precision and have such a timeout,
|
||||||
* you may want to use g_timeout_add() instead.
|
* you may want to use g_timeout_add() instead.
|
||||||
|
Loading…
Reference in New Issue
Block a user