diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-09-30 14:22:04 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-10-02 20:04:03 -0400 |
commit | 8e43470c3827f5980f39bf9da0bc510858daf2be (patch) | |
tree | b21013a6f6ebc8874ddd12a1ae132c890ddc2dec /glib/gthread.h | |
parent | 7a75f56aa16ac13607a13f4e455a4fa4248ff750 (diff) | |
download | glib-8e43470c3827f5980f39bf9da0bc510858daf2be.tar.gz |
Stop dithering over GPrivate
Take out the half-private g_private_init() stuff and replace it with a
G_PRIVATE_INIT macro that allows specifying a GDestroyNotify.
Expose the GPrivate structure in a public header.
Add a g_private_replace() to (sort of) match the functionality of
g_static_mutex_set().
Improve the documentation.
Deprecate g_private_new().
Diffstat (limited to 'glib/gthread.h')
-rw-r--r-- | glib/gthread.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/glib/gthread.h b/glib/gthread.h index 1161972fb..67106e541 100644 --- a/glib/gthread.h +++ b/glib/gthread.h @@ -112,6 +112,14 @@ struct _GRecMutex gpointer impl; }; +#define G_PRIVATE_INIT(notify) { NULL, (notify), { NULL, NULL } } +struct _GPrivate +{ + gpointer p; + GDestroyNotify notify; + gpointer future[2]; +}; + void g_thread_init (gpointer vtable); gboolean g_thread_get_initialized (void); @@ -274,10 +282,11 @@ gboolean g_cond_timedwait (GCond GMutex *mutex, gint64 abs_time); -GPrivate * g_private_new (GDestroyNotify notify); gpointer g_private_get (GPrivate *key); void g_private_set (GPrivate *key, gpointer value); +void g_private_replace (GPrivate *key, + gpointer value); G_END_DECLS |