diff options
author | Tobias Brunner <tobias@strongswan.org> | 2009-12-08 16:53:01 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2009-12-23 17:01:53 +0100 |
commit | eba64cef41f6db11ca751a0f207d0bba052b4093 (patch) | |
tree | d0b1098f4c7eba59c86f527660fcc229177dde1d /src/libstrongswan/threading/mutex.c | |
parent | f36143b0baa9ecfa7930780c53a73e74c91577db (diff) | |
download | strongswan-eba64cef41f6db11ca751a0f207d0bba052b4093.tar.bz2 strongswan-eba64cef41f6db11ca751a0f207d0bba052b4093.tar.xz |
Separated the public interfaces of the threading primitives.
Diffstat (limited to 'src/libstrongswan/threading/mutex.c')
-rw-r--r-- | src/libstrongswan/threading/mutex.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/libstrongswan/threading/mutex.c b/src/libstrongswan/threading/mutex.c index a3d131a05..6133822c3 100644 --- a/src/libstrongswan/threading/mutex.c +++ b/src/libstrongswan/threading/mutex.c @@ -17,13 +17,62 @@ #define _GNU_SOURCE #include <pthread.h> -#include <threading.h> #include <library.h> #include <debug.h> #include "mutex.h" #include "lock_profiler.h" +typedef struct private_mutex_t private_mutex_t; +typedef struct private_r_mutex_t private_r_mutex_t; + +/** + * private data of mutex + */ +struct private_mutex_t { + + /** + * public functions + */ + mutex_t public; + + /** + * wrapped pthread mutex + */ + pthread_mutex_t mutex; + + /** + * is this a recursiv emutex, implementing private_r_mutex_t? + */ + bool recursive; + + /** + * profiling info, if enabled + */ + lock_profile_t profile; +}; + +/** + * private data of mutex, extended by recursive locking information + */ +struct private_r_mutex_t { + + /** + * Extends private_mutex_t + */ + private_mutex_t generic; + + /** + * thread which currently owns mutex + */ + pthread_t thread; + + /** + * times we have locked the lock, stored per thread + */ + pthread_key_t times; +}; + /** * Implementation of mutex_t.lock. */ |