diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2007-04-22 16:13:22 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2007-04-22 16:13:33 -0400 |
commit | ce91a176489f4cb8f40c5ec29f23881d1e013a9f (patch) | |
tree | a14bd58eecd52ebabb8cb5b8e565c7825f5f2655 | |
parent | 97b50e99bfa785d77b4900d3070f22a22827db22 (diff) |
[cairo-mutex] Add a poor man's mutex implementation in case of CAIRO_NO_MUTEX
just for fun.
-rw-r--r-- | src/cairo-mutex-private.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h index 92770108a..9b9adbae2 100644 --- a/src/cairo-mutex-private.h +++ b/src/cairo-mutex-private.h @@ -57,11 +57,14 @@ CAIRO_BEGIN_DECLS #if CAIRO_NO_MUTEX -typedef int cairo_mutex_t; -# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP -# define CAIRO_MUTEX_LOCK(name) CAIRO_MUTEX_NOOP -# define CAIRO_MUTEX_UNLOCK(name) CAIRO_MUTEX_NOOP -# define CAIRO_MUTEX_NIL_INITIALIZER 0 +/* A poor man's mutex */ + + typedef int cairo_mutex_t; + +# define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP +# define CAIRO_MUTEX_LOCK(name) do { while (name) ; (name) = 1; } while (0) +# define CAIRO_MUTEX_UNLOCK(name) (name) = 0 +# define CAIRO_MUTEX_NIL_INITIALIZER 0 #elif HAVE_PTHREAD_H /*******************************************************/ |