[cairo-mutex] Add a poor man's mutex implementation in case of CAIRO_NO_MUTEX

just for fun.
This commit is contained in:
Behdad Esfahbod 2007-04-22 16:13:22 -04:00
parent 97b50e99bf
commit ce91a17648

View file

@ -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 /*******************************************************/