summaryrefslogtreecommitdiff
path: root/gobject/gobject.h
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-12-06 12:27:07 +0000
committerRyan Lortie <desrt@desrt.ca>2012-01-02 12:23:15 -0500
commit46c2f570da10c93d7b2fab790048f957bb422302 (patch)
tree4c14936542f6e3d53dde9d71ccbfa19bd8fe738d /gobject/gobject.h
parent28c87a5594ef05a324a183d6d3271e6733abf908 (diff)
downloadglib-46c2f570da10c93d7b2fab790048f957bb422302.tar.gz
GWeakRef: add a weak GObject reference believed to be thread-safe
This patch is a joint work with Simon McVittie. https://bugzilla.gnome.org/show_bug.cgi?id=548954
Diffstat (limited to 'gobject/gobject.h')
-rw-r--r--gobject/gobject.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gobject/gobject.h b/gobject/gobject.h
index ea3b048ab..35727365d 100644
--- a/gobject/gobject.h
+++ b/gobject/gobject.h
@@ -575,6 +575,18 @@ void g_clear_object (volatile GObject **object_ptr);
g_object_unref (_o); \
} G_STMT_END
+typedef struct {
+ /*<private>*/
+ union { gpointer p; } priv;
+} GWeakRef;
+
+void g_weak_ref_init (GWeakRef *weak_ref,
+ gpointer object);
+void g_weak_ref_clear (GWeakRef *weak_ref);
+gpointer g_weak_ref_get (GWeakRef *weak_ref);
+void g_weak_ref_set (GWeakRef *weak_ref,
+ gpointer object);
+
G_END_DECLS
#endif /* __G_OBJECT_H__ */