[glib/wip/ebassi/rc-new] fixup! Add reference counting types



commit 03b4dc160f925cb6d9e555df432df921e50c1180
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue May 22 10:17:30 2018 +0100

    fixup! Add reference counting types

 glib/grefcount.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
---
diff --git a/glib/grefcount.c b/glib/grefcount.c
index b747f8793..93558e3f2 100644
--- a/glib/grefcount.c
+++ b/glib/grefcount.c
@@ -30,6 +30,11 @@
  * GLib uses reference counting in many of its data types, and provides
  * the #grefcount and #gatomicrefcount types to implement safe and atomic
  * reference counting semantics.
+ *
+ * It is important to note that #grefcount and #gatomicrefcount should be
+ * considered completely opaque types; you should always use the provided
+ * API to increase and decrease the counters, and you should never check
+ * their content directly, or compare their content with other values.
  */
 
 #include "config.h"
@@ -39,6 +44,32 @@
 #include "gatomic.h"
 #include "gmessages.h"
 
+/**
+ * grefcount:
+ *
+ * A type for implementing reference count semantics.
+ *
+ * Use g_ref_count_init() to initialize it; g_ref_count_inc() to
+ * increase the counter, and g_ref_count_dec() to decrease it.
+ *
+ * See also: #gatomicrefcount
+ *
+ * Since: 2.58
+ */
+
+/**
+ * gatomicrefcount:
+ *
+ * A type for implementing atomic reference count semantics.
+ *
+ * Use g_atomic_ref_count_init() to initialize it; g_atomic_ref_count_inc()
+ * to increase the counter, and g_atomic_ref_count_dec() to decrease it.
+ *
+ * See also: #grefcount
+ *
+ * Since: 2.58
+ */
+
 /**
  * g_ref_count_init:
  * @rc: the address of a reference count variable


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