Mercurial > audlegacy
changeset 3448:004f822505b0 trunk
Added Tuple RW-lock debugging.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 07 Sep 2007 19:53:34 +0300 |
parents | 7043b5c94a94 |
children | 6dff6e58ce71 |
files | src/audacious/tuple.c |
diffstat | 1 files changed, 23 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/tuple.c Fri Sep 07 03:41:14 2007 -0500 +++ b/src/audacious/tuple.c Fri Sep 07 19:53:34 2007 +0300 @@ -27,12 +27,30 @@ static mowgli_heap_t *tuple_value_heap = NULL; static mowgli_object_class_t tuple_klass; -static GStaticRWLock tuple_rwlock = G_STATIC_RW_LOCK_INIT; +#define TUPLE_LOCKING +//#define TUPLE_DEBUG -#define TUPLE_LOCK_WRITE(XX) g_static_rw_lock_writer_lock(&tuple_rwlock) -#define TUPLE_UNLOCK_WRITE(XX) g_static_rw_lock_writer_unlock(&tuple_rwlock) -#define TUPLE_LOCK_READ(XX) g_static_rw_lock_reader_lock(&tuple_rwlock) -#define TUPLE_UNLOCK_READ(XX) g_static_rw_lock_reader_unlock(&tuple_rwlock) +#ifdef TUPLE_LOCKING +static GStaticRWLock tuple_rwlock = G_STATIC_RW_LOCK_INIT; +# ifdef TUPLE_DEBUG +# define TUPDEB(X) fprintf(stderr, "TUPLE_" X "(%s:%d)\n", __FUNCTION__, __LINE__) +# define TUPLE_LOCK_WRITE(XX) { TUPDEB("LOCK_WRITE"); g_static_rw_lock_writer_lock(&tuple_rwlock); } +# define TUPLE_UNLOCK_WRITE(XX) { TUPDEB("UNLOCK_WRITE"); g_static_rw_lock_writer_unlock(&tuple_rwlock); } +# define TUPLE_LOCK_READ(XX) { TUPDEB("LOCK_READ"); g_static_rw_lock_reader_lock(&tuple_rwlock); } +# define TUPLE_UNLOCK_READ(XX) { TUPDEB("UNLOCK_READ"); g_static_rw_lock_reader_unlock(&tuple_rwlock); } +# undef TUPDEP +# else +# define TUPLE_LOCK_WRITE(XX) g_static_rw_lock_writer_lock(&tuple_rwlock) +# define TUPLE_UNLOCK_WRITE(XX) g_static_rw_lock_writer_unlock(&tuple_rwlock) +# define TUPLE_LOCK_READ(XX) g_static_rw_lock_reader_lock(&tuple_rwlock) +# define TUPLE_UNLOCK_READ(XX) g_static_rw_lock_reader_unlock(&tuple_rwlock) +# endif +#else +# define TUPLE_LOCK_WRITE(XX) +# define TUPLE_UNLOCK_WRITE(XX) +# define TUPLE_LOCK_READ(XX) +# define TUPLE_UNLOCK_READ(XX) +#endif /* iterative destructor of tuple values. */ static void