goo/GooMutex.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
New commits: commit a65a4e6f878ff033b780b2f1e3362f2918c93b6b Author: Adam Reichold <[email protected]> Date: Sat Apr 6 18:25:21 2013 +0200 No need to keep the mutex attributes around all the time diff --git a/goo/GooMutex.h b/goo/GooMutex.h index 4d425a2..e9d5a54 100644 --- a/goo/GooMutex.h +++ b/goo/GooMutex.h @@ -18,6 +18,7 @@ // Copyright (C) 2009 Kovid Goyal <[email protected]> // Copyright (C) 2013 Thomas Freitag <[email protected]> // Copyright (C) 2013 Albert Astals Cid <[email protected]> +// Copyright (C) 2013 Adam Reichold <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -53,26 +54,18 @@ typedef CRITICAL_SECTION GooMutex; #include <pthread.h> -typedef struct { - pthread_mutexattr_t attributes; - pthread_mutex_t mutex; -} GooMutex; +typedef pthread_mutex_t GooMutex; inline void gInitMutex(GooMutex *m) { - pthread_mutexattr_init(&m->attributes); - pthread_mutexattr_settype(&m->attributes, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&m->mutex, &m->attributes); -} -inline void gDestroyMutex(GooMutex *m) { - pthread_mutex_destroy(&m->mutex); - pthread_mutexattr_destroy(&m->attributes); -} -inline void gLockMutex(GooMutex *m) { - pthread_mutex_lock(&m->mutex); -} -inline void gUnlockMutex(GooMutex *m) { - pthread_mutex_unlock(&m->mutex); + pthread_mutexattr_t mutexattr; + pthread_mutexattr_init(&mutexattr); + pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(m, &mutexattr); + pthread_mutexattr_destroy(&mutexattr); } +#define gDestroyMutex(m) pthread_mutex_destroy(m) +#define gLockMutex(m) pthread_mutex_lock(m) +#define gUnlockMutex(m) pthread_mutex_unlock(m) #endif _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
