# HG changeset patch # User Matti Hamalainen # Date 1189184014 -10800 # Node ID 004f822505b04d5ff26fc94139119ac000f6cd87 # Parent 7043b5c94a94a1e9a2f1924ea474a7ec10602b40 Added Tuple RW-lock debugging. diff -r 7043b5c94a94 -r 004f822505b0 src/audacious/tuple.c --- 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