/* Pixman uses some non-standard compiler features. This file ensures * they exist * * The features are: * * FUNC must be defined to expand to the current function * PIXMAN_EXPORT should be defined to whatever is required to * export functions from a shared library * limits limits for various types must be defined * inline must be defined * force_inline must be defined
*/ #ifdefined (__GNUC__) # define FUNC ((constchar*) (__PRETTY_FUNCTION__)) #elifdefined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) # define FUNC ((constchar*) (__func__)) #else # define FUNC ((constchar*) ("???")) #endif
# define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \ static pthread_once_t tls_ ## name ## _once_control = PTHREAD_ONCE_INIT; \ static pthread_key_t tls_ ## name ## _key; \
\ staticvoid \
tls_ ## name ## _destroy_value (void *value) \
{ \
free (value); \
} \
\ staticvoid \
tls_ ## name ## _make_key (void) \
{ \
pthread_key_create (&tls_ ## name ## _key, \
tls_ ## name ## _destroy_value); \
} \
\ static type * \
tls_ ## name ## _alloc (void) \
{ \
type *value = calloc (1, sizeof (type)); \ if (value) \
pthread_setspecific (tls_ ## name ## _key, value); \ return value; \
} \
\ static force_inline type * \
tls_ ## name ## _get (void) \
{ \
type *value = NULL; \ if (pthread_once (&tls_ ## name ## _once_control, \
tls_ ## name ## _make_key) == 0) \
{ \
value = pthread_getspecific (tls_ ## name ## _key); \ if (!value) \
value = tls_ ## name ## _alloc (); \
} \ return value; \
}
# define PIXMAN_GET_THREAD_LOCAL(name) \
tls_ ## name ## _get ()
#else
# error "Unknown thread local support for this system. Pixman will not work with multiple threads. Define PIXMAN_NO_TLS to acknowledge and accept this limitation and compile pixman without thread-safety support."
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.