summaryrefslogtreecommitdiff
path: root/gthread.h
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>2001-02-13 15:57:44 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>2001-02-13 15:57:44 +0000
commit41e2001d85966ce3bd9133e49b070a00926bd6ea (patch)
tree6bb0a9ea4141246a9b1235cb3d143bef901e7f7c /gthread.h
parentcc0f6f0232e471031546faec64239cf91a2a4b83 (diff)
Added functions g_static_rec_mutex_init, g_static_rec_mutex_free,
2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gthread.c, gthread.h: Added functions g_static_rec_mutex_init, g_static_rec_mutex_free, g_static_private_init, g_static_private_free, g_static_rw_lock_init to allow the usage of all those types dynamically. (g_static_rw_lock_free already existed). Aditionally freed static_private indeces are reused now. Untill now the array would just grow if you would use more and more static_private. That required adding a slist of all running threads, which could potentially be of good use later. It is not exported however. Renamed a LOCK and small indentation fixes. * tests/thread-test.c: Test the new static_private index freing and reusing feature.
Diffstat (limited to 'gthread.h')
-rw-r--r--gthread.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/gthread.h b/gthread.h
index 1f86418f4..44145d56c 100644
--- a/gthread.h
+++ b/gthread.h
@@ -46,8 +46,8 @@ G_BEGIN_DECLS
/* GLib Thread support
*/
-extern GQuark g_thread_error_quark();
-#define G_THREAD_ERROR g_thread_error_quark()
+extern GQuark g_thread_error_quark (void);
+#define G_THREAD_ERROR g_thread_error_quark ()
typedef enum
{
@@ -235,16 +235,18 @@ struct _GStaticPrivate
guint index;
};
#define G_STATIC_PRIVATE_INIT { 0 }
-gpointer g_static_private_get (GStaticPrivate *private_key);
-void g_static_private_set (GStaticPrivate *private_key,
- gpointer data,
- GDestroyNotify notify);
-gpointer g_static_private_get_for_thread (GStaticPrivate *private_key,
- GThread *thread);
-void g_static_private_set_for_thread (GStaticPrivate *private_key,
- GThread *thread,
- gpointer data,
- GDestroyNotify notify);
+void g_static_private_init (GStaticPrivate *private_key);
+gpointer g_static_private_get (GStaticPrivate *private_key);
+void g_static_private_set (GStaticPrivate *private_key,
+ gpointer data,
+ GDestroyNotify notify);
+gpointer g_static_private_get_for_thread (GStaticPrivate *private_key,
+ GThread *thread);
+void g_static_private_set_for_thread (GStaticPrivate *private_key,
+ GThread *thread,
+ gpointer data,
+ GDestroyNotify notify);
+void g_static_private_free (GStaticPrivate *private_key);
typedef struct _GStaticRecMutex GStaticRecMutex;
struct _GStaticRecMutex
@@ -255,12 +257,14 @@ struct _GStaticRecMutex
};
#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
+void g_static_rec_mutex_init (GStaticRecMutex *mutex);
void g_static_rec_mutex_lock (GStaticRecMutex *mutex);
gboolean g_static_rec_mutex_trylock (GStaticRecMutex *mutex);
void g_static_rec_mutex_unlock (GStaticRecMutex *mutex);
void g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
guint depth);
guint g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
+void g_static_rec_mutex_free (GStaticRecMutex *mutex);
typedef struct _GStaticRWLock GStaticRWLock;
struct _GStaticRWLock
@@ -275,13 +279,14 @@ struct _GStaticRWLock
#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, FALSE }
+void g_static_rw_lock_init (GStaticRWLock* lock);
void g_static_rw_lock_reader_lock (GStaticRWLock* lock);
gboolean g_static_rw_lock_reader_trylock (GStaticRWLock* lock);
void g_static_rw_lock_reader_unlock (GStaticRWLock* lock);
void g_static_rw_lock_writer_lock (GStaticRWLock* lock);
gboolean g_static_rw_lock_writer_trylock (GStaticRWLock* lock);
void g_static_rw_lock_writer_unlock (GStaticRWLock* lock);
-void g_static_rw_lock_free (GStaticRWLock* lock);
+void g_static_rw_lock_free (GStaticRWLock* lock);
/* these are some convenience macros that expand to nothing if GLib
* was configured with --disable-threads. for using StaticMutexes,