Rename all mutex variables to start with an underscore

since they are not static in some of the implementations (win32, ...)
This commit is contained in:
Behdad Esfahbod 2007-03-05 15:59:43 -05:00
parent c8b84a4735
commit a487d09421
7 changed files with 55 additions and 55 deletions

View file

@ -985,19 +985,19 @@ cairo_beos_surface_create_for_bitmap (BView* view,
class BeLocks {
public:
BLocker cairo_font_face_mutex;
BLocker cairo_scaled_font_map_mutex;
BLocker _cairo_font_face_mutex;
BLocker _cairo_scaled_font_map_mutex;
#ifdef CAIRO_HAS_FT_FONT
BLocker cairo_ft_unscaled_font_map_mutex;
BLocker _cairo_ft_unscaled_font_map_mutex;
#endif
};
static BeLocks locks;
void* cairo_font_face_mutex = &locks.cairo_font_face_mutex;
void* cairo_scaled_font_map_mutex = &locks.cairo_scaled_font_map_mutex;
void* _cairo_font_face_mutex = &locks._cairo_font_face_mutex;
void* _cairo_scaled_font_map_mutex = &locks._cairo_scaled_font_map_mutex;
#ifdef CAIRO_HAS_FT_FONT
void* cairo_ft_unscaled_font_map_mutex = &locks.cairo_ft_unscaled_font_map_mutex;
void* _cairo_ft_unscaled_font_map_mutex = &locks._cairo_ft_unscaled_font_map_mutex;
#endif
void _cairo_beos_lock (void* locker) {

View file

@ -68,7 +68,7 @@ _cairo_font_face_init (cairo_font_face_t *font_face,
/* This mutex protects both cairo_toy_font_hash_table as well as
reference count manipulations for all cairo_font_face_t. */
CAIRO_MUTEX_DECLARE (cairo_font_face_mutex);
CAIRO_MUTEX_DECLARE (_cairo_font_face_mutex);
/**
* cairo_font_face_reference:
@ -93,7 +93,7 @@ cairo_font_face_reference (cairo_font_face_t *font_face)
if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
return font_face;
CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
/* We would normally assert (font_face->ref_count >0) here but we
* can't get away with that due to the zombie case as documented
@ -101,7 +101,7 @@ cairo_font_face_reference (cairo_font_face_t *font_face)
font_face->ref_count++;
CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
return font_face;
}
@ -124,16 +124,16 @@ cairo_font_face_destroy (cairo_font_face_t *font_face)
if (font_face->ref_count == CAIRO_REF_COUNT_INVALID)
return;
CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
assert (font_face->ref_count > 0);
if (--(font_face->ref_count) > 0) {
CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
return;
}
CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
font_face->backend->destroy (font_face);
@ -266,14 +266,14 @@ _cairo_toy_font_face_keys_equal (const void *key_a,
* downstream caches, we don't need them in this hash table anymore.
*
* Modifications to this hash table are protected by
* cairo_font_face_mutex.
* _cairo_font_face_mutex.
*/
static cairo_hash_table_t *cairo_toy_font_face_hash_table = NULL;
static cairo_hash_table_t *
_cairo_toy_font_face_hash_table_lock (void)
{
CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
if (cairo_toy_font_face_hash_table == NULL)
{
@ -281,7 +281,7 @@ _cairo_toy_font_face_hash_table_lock (void)
_cairo_hash_table_create (_cairo_toy_font_face_keys_equal);
if (cairo_toy_font_face_hash_table == NULL) {
CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
return NULL;
}
}
@ -292,7 +292,7 @@ _cairo_toy_font_face_hash_table_lock (void)
static void
_cairo_toy_font_face_hash_table_unlock (void)
{
CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
}
/**
@ -515,8 +515,8 @@ _cairo_font_reset_static_data (void)
/* We manually acquire the lock rather than calling
* cairo_toy_font_face_hash_table_lock simply to avoid
* creating the table only to destroy it again. */
CAIRO_MUTEX_LOCK (cairo_font_face_mutex);
CAIRO_MUTEX_LOCK (_cairo_font_face_mutex);
_cairo_hash_table_destroy (cairo_toy_font_face_hash_table);
cairo_toy_font_face_hash_table = NULL;
CAIRO_MUTEX_UNLOCK (cairo_font_face_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex);
}

View file

@ -150,7 +150,7 @@ typedef struct _cairo_ft_unscaled_font_map {
static cairo_ft_unscaled_font_map_t *cairo_ft_unscaled_font_map = NULL;
CAIRO_MUTEX_DECLARE(cairo_ft_unscaled_font_map_mutex);
CAIRO_MUTEX_DECLARE(_cairo_ft_unscaled_font_map_mutex);
static void
_font_map_release_face_lock_held (cairo_ft_unscaled_font_map_t *font_map,
@ -208,7 +208,7 @@ _cairo_ft_unscaled_font_map_destroy (void)
cairo_ft_unscaled_font_t *unscaled;
cairo_ft_unscaled_font_map_t *font_map;
CAIRO_MUTEX_LOCK (cairo_ft_unscaled_font_map_mutex);
CAIRO_MUTEX_LOCK (_cairo_ft_unscaled_font_map_mutex);
if (cairo_ft_unscaled_font_map) {
font_map = cairo_ft_unscaled_font_map;
@ -241,20 +241,20 @@ _cairo_ft_unscaled_font_map_destroy (void)
cairo_ft_unscaled_font_map = NULL;
}
CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
}
static cairo_ft_unscaled_font_map_t *
_cairo_ft_unscaled_font_map_lock (void)
{
CAIRO_MUTEX_LOCK (cairo_ft_unscaled_font_map_mutex);
CAIRO_MUTEX_LOCK (_cairo_ft_unscaled_font_map_mutex);
if (cairo_ft_unscaled_font_map == NULL)
{
_cairo_ft_unscaled_font_map_create ();
if (cairo_ft_unscaled_font_map == NULL) {
CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
return NULL;
}
}
@ -265,7 +265,7 @@ _cairo_ft_unscaled_font_map_lock (void)
static void
_cairo_ft_unscaled_font_map_unlock (void)
{
CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
}
static void

View file

@ -69,11 +69,11 @@
static int cairo_os2_initialization_count = 0;
/* The mutex semaphores Cairo uses all around: */
HMTX cairo_scaled_font_map_mutex = 0;
HMTX _cairo_scaled_font_map_mutex = 0;
HMTX _global_image_glyph_cache_mutex = 0;
HMTX cairo_font_face_mutex = 0;
HMTX _cairo_font_face_mutex = 0;
#ifdef CAIRO_HAS_FT_FONT
HMTX cairo_ft_unscaled_font_map_mutex = 0;
HMTX _cairo_ft_unscaled_font_map_mutex = 0;
#endif
static void inline
@ -106,13 +106,13 @@ cairo_os2_init (void)
/* Create the mutex semaphores we'll use! */
/* cairo-font.c: */
DosCreateMutexSem (NULL, &cairo_scaled_font_map_mutex, 0, FALSE);
DosCreateMutexSem (NULL, &_cairo_scaled_font_map_mutex, 0, FALSE);
DosCreateMutexSem (NULL, &_global_image_glyph_cache_mutex, 0, FALSE);
DosCreateMutexSem (NULL, &cairo_font_face_mutex, 0, FALSE);
DosCreateMutexSem (NULL, &_cairo_font_face_mutex, 0, FALSE);
#ifdef CAIRO_HAS_FT_FONT
/* cairo-ft-font.c: */
DosCreateMutexSem (NULL, &cairo_ft_unscaled_font_map_mutex, 0, FALSE);
DosCreateMutexSem (NULL, &_cairo_ft_unscaled_font_map_mutex, 0, FALSE);
#endif
/* Initialize FontConfig */
@ -139,24 +139,24 @@ cairo_os2_fini (void)
/* Destroy the mutex semaphores we've created! */
/* cairo-font.c: */
if (cairo_scaled_font_map_mutex) {
DosCloseMutexSem (cairo_scaled_font_map_mutex);
cairo_scaled_font_map_mutex = 0;
if (_cairo_scaled_font_map_mutex) {
DosCloseMutexSem (_cairo_scaled_font_map_mutex);
_cairo_scaled_font_map_mutex = 0;
}
if (_global_image_glyph_cache_mutex) {
DosCloseMutexSem (_global_image_glyph_cache_mutex);
_global_image_glyph_cache_mutex = 0;
}
if (cairo_font_face_mutex) {
DosCloseMutexSem (cairo_font_face_mutex);
cairo_font_face_mutex = 0;
if (_cairo_font_face_mutex) {
DosCloseMutexSem (_cairo_font_face_mutex);
_cairo_font_face_mutex = 0;
}
#ifdef CAIRO_HAS_FT_FONT
/* cairo-ft-font.c: */
if (cairo_ft_unscaled_font_map_mutex) {
DosCloseMutexSem (cairo_ft_unscaled_font_map_mutex);
cairo_ft_unscaled_font_map_mutex = 0;
if (_cairo_ft_unscaled_font_map_mutex) {
DosCloseMutexSem (_cairo_ft_unscaled_font_map_mutex);
_cairo_ft_unscaled_font_map_mutex = 0;
}
#endif

View file

@ -185,7 +185,7 @@ typedef struct _cairo_scaled_font_map {
static cairo_scaled_font_map_t *cairo_scaled_font_map = NULL;
CAIRO_MUTEX_DECLARE (cairo_scaled_font_map_mutex);
CAIRO_MUTEX_DECLARE (_cairo_scaled_font_map_mutex);
static int
_cairo_scaled_font_keys_equal (const void *abstract_key_a, const void *abstract_key_b);
@ -193,7 +193,7 @@ _cairo_scaled_font_keys_equal (const void *abstract_key_a, const void *abstract_
static cairo_scaled_font_map_t *
_cairo_scaled_font_map_lock (void)
{
CAIRO_MUTEX_LOCK (cairo_scaled_font_map_mutex);
CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
if (cairo_scaled_font_map == NULL) {
cairo_scaled_font_map = malloc (sizeof (cairo_scaled_font_map_t));
@ -214,14 +214,14 @@ _cairo_scaled_font_map_lock (void)
CLEANUP_SCALED_FONT_MAP:
free (cairo_scaled_font_map);
CLEANUP_MUTEX_LOCK:
CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
return NULL;
}
static void
_cairo_scaled_font_map_unlock (void)
{
CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
}
void
@ -231,7 +231,7 @@ _cairo_scaled_font_map_destroy (void)
cairo_scaled_font_map_t *font_map;
cairo_scaled_font_t *scaled_font;
CAIRO_MUTEX_LOCK (cairo_scaled_font_map_mutex);
CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
font_map = cairo_scaled_font_map;
if (font_map == NULL) {
@ -256,7 +256,7 @@ _cairo_scaled_font_map_destroy (void)
cairo_scaled_font_map = NULL;
CLEANUP_MUTEX_LOCK:
CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex);
CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
}
/* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/)

View file

@ -1895,11 +1895,11 @@ static const cairo_surface_backend_t cairo_win32_surface_backend = {
*/
#if !defined(HAVE_PTHREAD_H)
CRITICAL_SECTION cairo_scaled_font_map_mutex;
CRITICAL_SECTION _cairo_scaled_font_map_mutex;
#ifdef CAIRO_HAS_FT_FONT
CRITICAL_SECTION cairo_ft_unscaled_font_map_mutex;
CRITICAL_SECTION _cairo_ft_unscaled_font_map_mutex;
#endif
CRITICAL_SECTION cairo_font_face_mutex;
CRITICAL_SECTION _cairo_font_face_mutex;
static int _cairo_win32_initialized = 0;
@ -1909,11 +1909,11 @@ _cairo_win32_initialize (void) {
return;
/* every 'mutex' from CAIRO_MUTEX_DECALRE needs to be initialized here */
InitializeCriticalSection (&cairo_scaled_font_map_mutex);
InitializeCriticalSection (&_cairo_scaled_font_map_mutex);
#ifdef CAIRO_HAS_FT_FONT
InitializeCriticalSection (&cairo_ft_unscaled_font_map_mutex);
InitializeCriticalSection (&_cairo_ft_unscaled_font_map_mutex);
#endif
InitializeCriticalSection (&cairo_font_face_mutex);
InitializeCriticalSection (&_cairo_font_face_mutex);
_cairo_win32_initialized = 1;
}
@ -1930,11 +1930,11 @@ DllMain (HINSTANCE hinstDLL,
_cairo_win32_initialize();
break;
case DLL_PROCESS_DETACH:
DeleteCriticalSection (&cairo_scaled_font_map_mutex);
DeleteCriticalSection (&_cairo_scaled_font_map_mutex);
#ifdef CAIRO_HAS_FT_FONT
DeleteCriticalSection (&cairo_ft_unscaled_font_map_mutex);
DeleteCriticalSection (&_cairo_ft_unscaled_font_map_mutex);
#endif
DeleteCriticalSection (&cairo_font_face_mutex);
DeleteCriticalSection (&_cairo_font_face_mutex);
break;
}
return TRUE;

View file

@ -563,7 +563,7 @@ struct _cairo_scaled_font {
* 1. The reference count (scaled_font->ref_count)
*
* Modifications to the reference count are protected by the
* cairo_scaled_font_map_mutex. This is because the reference
* _cairo_scaled_font_map_mutex. This is because the reference
* count of a scaled font is intimately related with the font
* map itself, (and the magic holdovers array).
*