~ubuntu-branches/ubuntu/hardy/libgdiplus/hardy

« back to all changes in this revision

Viewing changes to cairo/src/cairo-mutex-private.h

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2007-12-18 13:08:10 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20071218130810-hlmitxfddf6h511j
Tags: 1.2.6-1ubuntu1
* Sync with Debian:
  - debian/control:
    + Add lpia and sparc to the architectures. We support them.
    + Change Maintainer to Ubuntu Mono Team.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
#include "cairo-mutex-type-private.h"
51
51
 
 
52
/* Only the following three are mandatory at this point */
 
53
#ifndef CAIRO_MUTEX_LOCK
 
54
# error "CAIRO_MUTEX_LOCK not defined.  Check cairo-mutex-type-private.h."
 
55
#endif
 
56
#ifndef CAIRO_MUTEX_UNLOCK
 
57
# error "CAIRO_MUTEX_UNLOCK not defined.  Check cairo-mutex-type-private.h."
 
58
#endif
 
59
#ifndef CAIRO_MUTEX_NIL_INITIALIZER
 
60
# error "CAIRO_MUTEX_NIL_INITIALIZER not defined.  Check cairo-mutex-type-private.h."
 
61
#endif
 
62
 
52
63
CAIRO_BEGIN_DECLS
53
64
 
54
 
#ifndef CAIRO_MUTEX_DECLARE
55
 
#define CAIRO_MUTEX_DECLARE(name) extern cairo_mutex_t name;
56
 
#endif
 
65
 
 
66
#define CAIRO_MUTEX_DECLARE(mutex) extern cairo_mutex_t mutex
57
67
#include "cairo-mutex-list-private.h"
58
68
#undef CAIRO_MUTEX_DECLARE
59
69
 
60
70
 
61
 
#ifndef CAIRO_MUTEX_INIT
62
 
# define CAIRO_MUTEX_INIT(_mutex) do {                          \
63
 
    cairo_mutex_t _tmp_mutex = CAIRO_MUTEX_NIL_INITIALIZER;     \
64
 
    memcpy ((_mutex), &_tmp_mutex, sizeof (_tmp_mutex));        \
65
 
} while (0)
66
 
#endif
67
 
 
68
 
#ifndef CAIRO_MUTEX_FINI
69
 
# define CAIRO_MUTEX_FINI(mutex)        CAIRO_MUTEX_NOOP
70
 
#endif
71
 
 
72
 
 
73
 
#ifndef CAIRO_MUTEX_INITIALIZE
74
 
# define CAIRO_MUTEX_USE_GENERIC_INITIALIZATION 1
75
 
#else
76
 
# undef CAIRO_MUTEX_USE_GENERIC_INITIALIZATION
 
71
/* make sure implementations don't fool us: we decide these ourself */
 
72
#undef _CAIRO_MUTEX_USE_STATIC_INITIALIZER
 
73
#undef _CAIRO_MUTEX_USE_STATIC_FINALIZER
 
74
 
 
75
 
 
76
#ifdef CAIRO_MUTEX_INIT
 
77
 
 
78
/* If CAIRO_MUTEX_INIT is defined, we may need to initialize all
 
79
 * static mutex'es. */
 
80
# ifndef CAIRO_MUTEX_INITIALIZE
 
81
#  define CAIRO_MUTEX_INITIALIZE() do { \
 
82
       if (!_cairo_mutex_initialized)   \
 
83
           _cairo_mutex_initialize ();  \
 
84
   } while(0)
 
85
 
 
86
   cairo_private void _cairo_mutex_initialize (void);
 
87
 
 
88
   /* and make sure we implement the above */
 
89
#  define _CAIRO_MUTEX_USE_STATIC_INITIALIZER 1
 
90
# endif /* CAIRO_MUTEX_INITIALIZE */
 
91
 
 
92
#else /* no CAIRO_MUTEX_INIT */
 
93
 
 
94
/* Otherwise we probably don't need to initialize static mutex'es, */
 
95
# ifndef CAIRO_MUTEX_INITIALIZE
 
96
#  define CAIRO_MUTEX_INITIALIZE() CAIRO_MUTEX_NOOP
 
97
# endif /* CAIRO_MUTEX_INITIALIZE */
 
98
 
 
99
/* and dynamic ones can be initialized using the static initializer. */
 
100
# define CAIRO_MUTEX_INIT(mutex) do {                           \
 
101
      cairo_mutex_t _tmp_mutex = CAIRO_MUTEX_NIL_INITIALIZER;   \
 
102
      memcpy (&(mutex), &_tmp_mutex, sizeof (_tmp_mutex));      \
 
103
  } while (0)
 
104
 
 
105
#endif /* CAIRO_MUTEX_INIT */
 
106
 
 
107
 
 
108
#ifdef CAIRO_MUTEX_FINI
 
109
 
 
110
/* If CAIRO_MUTEX_FINI is defined, we may need to finalize all
 
111
 * static mutex'es. */
 
112
# ifndef CAIRO_MUTEX_FINALIZE
 
113
#  define CAIRO_MUTEX_FINALIZE() do {   \
 
114
       if (_cairo_mutex_initialized)    \
 
115
           _cairo_mutex_finalize ();    \
 
116
   } while(0)
 
117
 
 
118
   cairo_private void _cairo_mutex_finalize (void);
 
119
 
 
120
   /* and make sure we implement the above */
 
121
#  define _CAIRO_MUTEX_USE_STATIC_FINALIZER 1
 
122
# endif /* CAIRO_MUTEX_FINALIZE */
 
123
 
 
124
#else /* no CAIRO_MUTEX_FINI */
 
125
 
 
126
/* Otherwise we probably don't need to finalize static mutex'es, */
77
127
# ifndef CAIRO_MUTEX_FINALIZE
78
128
#  define CAIRO_MUTEX_FINALIZE() CAIRO_MUTEX_NOOP
79
 
# endif
80
 
#endif
81
 
 
82
 
#if CAIRO_MUTEX_USE_GENERIC_INITIALIZATION
83
 
 
84
 
#define CAIRO_MUTEX_INITIALIZE() do { \
85
 
    if (!_cairo_mutex_initialized) \
86
 
        _cairo_mutex_initialize (); \
87
 
} while(0)
88
 
 
89
 
#define CAIRO_MUTEX_FINALIZE() do { \
90
 
    if (_cairo_mutex_initialized) \
91
 
        _cairo_mutex_finalize (); \
92
 
} while(0)
93
 
 
94
 
cairo_private extern cairo_bool_t _cairo_mutex_initialized;
95
 
cairo_private void _cairo_mutex_initialize(void);
96
 
cairo_private void _cairo_mutex_finalize(void);
97
 
 
98
 
#endif
 
129
# endif /* CAIRO_MUTEX_FINALIZE */
 
130
 
 
131
/* neither do the dynamic ones. */
 
132
# define CAIRO_MUTEX_FINI(mutex)        CAIRO_MUTEX_NOOP1(mutex)
 
133
 
 
134
#endif /* CAIRO_MUTEX_FINI */
 
135
 
 
136
 
 
137
#ifndef _CAIRO_MUTEX_USE_STATIC_INITIALIZER
 
138
#define _CAIRO_MUTEX_USE_STATIC_INITIALIZER 0
 
139
#endif
 
140
#ifndef _CAIRO_MUTEX_USE_STATIC_FINALIZER
 
141
#define _CAIRO_MUTEX_USE_STATIC_FINALIZER 0
 
142
#endif
 
143
 
 
144
/* only if using static initializer and/or finalizer define the boolean */
 
145
#if _CAIRO_MUTEX_USE_STATIC_INITIALIZER || _CAIRO_MUTEX_USE_STATIC_FINALIZER
 
146
  cairo_private extern cairo_bool_t _cairo_mutex_initialized;
 
147
#endif
 
148
 
99
149
 
100
150
CAIRO_END_DECLS
101
151