summaryrefslogtreecommitdiff
path: root/src/cairo-mutex-type-private.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-10-05 13:37:07 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-17 22:52:47 +0100
commitd11014386f739f43ec5f290714d7c51cc638f172 (patch)
tree3f548bc5d28829734cf1b61eb02e07d8c3077f84 /src/cairo-mutex-type-private.h
parentbccfdf7d93c2a92a342127fc212770f4053cb2cf (diff)
downloadcairo-d11014386f739f43ec5f290714d7c51cc638f172.tar.gz
Add support for lockdep.
lockdep is a valgrind skin which performs pthread locking correctness validation. In particular it allows one to write assert(HOLDS_LOCK(mutex)) which both documents the preconditions for a function and enforces them when the program is run under lockdep. As an aide to lockdep (as it works by intercepting the pthread functions), all the mutexes should be initialised and destroyed using pthread_mutex_init() and pthread_mutex_destroy() rather than using static initializers and no-ops.
Diffstat (limited to 'src/cairo-mutex-type-private.h')
-rw-r--r--src/cairo-mutex-type-private.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cairo-mutex-type-private.h b/src/cairo-mutex-type-private.h
index 2314be1d0..776b0db28 100644
--- a/src/cairo-mutex-type-private.h
+++ b/src/cairo-mutex-type-private.h
@@ -44,6 +44,8 @@
#include "cairo-compiler-private.h"
#include "cairo-mutex-impl-private.h"
+CAIRO_BEGIN_DECLS
+
/* Only the following three are mandatory at this point */
#ifndef CAIRO_MUTEX_IMPL_LOCK
# error "CAIRO_MUTEX_IMPL_LOCK not defined. Check cairo-mutex-impl-private.h."
@@ -90,7 +92,6 @@
#endif /* CAIRO_MUTEX_IMPL_INIT */
-
#ifdef CAIRO_MUTEX_IMPL_FINI
/* If %CAIRO_MUTEX_IMPL_FINI is defined, we may need to finalize all
@@ -169,6 +170,9 @@ typedef cairo_mutex_impl_t cairo_mutex_t;
#define CAIRO_MUTEX_FINI CAIRO_MUTEX_IMPL_FINI
#define CAIRO_MUTEX_NIL_INITIALIZER CAIRO_MUTEX_IMPL_NIL_INITIALIZER
+#ifndef CAIRO_HOLDS_MUTEX
+# define CAIRO_HOLDS_MUTEX(name) 1
+#endif
/* Debugging support */