mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-02 14:18:00 +02:00
[cairo-mutex] Add a poor man's mutex implementation in case of CAIRO_NO_MUTEX
just for fun.
This commit is contained in:
parent
97b50e99bf
commit
ce91a17648
1 changed files with 8 additions and 5 deletions
|
|
@ -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 /*******************************************************/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue