[glib] docs: Clarify lack of threading guarantees in GArray



commit 2586eb992193ee9226a7a2b92c1c644347e9a842
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Aug 22 15:58:18 2017 +0100

    docs: Clarify lack of threading guarantees in GArray
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786555

 glib/garray.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/glib/garray.c b/glib/garray.c
index c05b187..a476284 100644
--- a/glib/garray.c
+++ b/glib/garray.c
@@ -244,7 +244,7 @@ g_array_set_clear_func (GArray         *array,
  * @array: A #GArray
  *
  * Atomically increments the reference count of @array by one.
- * This function is MT-safe and may be called from any thread.
+ * This function is thread-safe and may be called from any thread.
  *
  * Returns: The passed in #GArray
  *
@@ -275,7 +275,7 @@ static gchar *array_free (GRealArray *, ArrayFreeFlags);
  *
  * Atomically decrements the reference count of @array by one. If the
  * reference count drops to 0, all memory allocated by the array is
- * released. This function is MT-safe and may be called from any
+ * released. This function is thread-safe and may be called from any
  * thread.
  *
  * Since: 2.22
@@ -326,6 +326,10 @@ g_array_get_element_size (GArray *array)
  * If array elements contain dynamically-allocated memory, they should
  * be freed separately.
  *
+ * This function is not thread-safe. If using a #GArray from multiple
+ * threads, use only the atomic g_array_ref() and g_array_unref()
+ * functions.
+ *
  * Returns: the element data if @free_segment is %FALSE, otherwise
  *     %NULL. The element data should be freed using g_free().
  */
@@ -1031,7 +1035,7 @@ static gpointer *ptr_array_free (GPtrArray *, ArrayFreeFlags);
  * Atomically decrements the reference count of @array by one. If the
  * reference count drops to 0, the effect is the same as calling
  * g_ptr_array_free() with @free_segment set to %TRUE. This function
- * is MT-safe and may be called from any thread.
+ * is thread-safe and may be called from any thread.
  *
  * Since: 2.22
  */
@@ -1062,6 +1066,10 @@ g_ptr_array_unref (GPtrArray *array)
  * be freed separately if @free_seg is %TRUE and no #GDestroyNotify
  * function has been set for @array.
  *
+ * This function is not thread-safe. If using a #GPtrArray from multiple
+ * threads, use only the atomic g_ptr_array_ref() and g_ptr_array_unref()
+ * functions.
+ *
  * Returns: the pointer array if @free_seg is %FALSE, otherwise %NULL.
  *     The pointer array should be freed using g_free().
  */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]