diff options
author | lloyd <[email protected]> | 2006-06-23 10:34:49 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-06-23 10:34:49 +0000 |
commit | 571fea5ac667b88a66604ecdba05d8324f5e9de7 (patch) | |
tree | fc7f8191e779ad3dc6fb2e4ac4e6c9f2acfed7c3 /modules/mux_pthr | |
parent | 714fe898764407cdb9ebcea30cbc69bf1a4bada8 (diff) |
Inline a number of small objects that are only used in a local context
(ie, a single function). This will, unfortunately, break GCC 2.95.x
support. Most of the operating systems that had shipped with 2.95.x,
like OpenBSD and QNX, have since upgraded. Anyone needing 2.95.x support
will have to continue using 1.4.x
Diffstat (limited to 'modules/mux_pthr')
-rw-r--r-- | modules/mux_pthr/mux_pthr.cpp | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/modules/mux_pthr/mux_pthr.cpp b/modules/mux_pthr/mux_pthr.cpp index ec2308fae..ade2005e9 100644 --- a/modules/mux_pthr/mux_pthr.cpp +++ b/modules/mux_pthr/mux_pthr.cpp @@ -14,48 +14,42 @@ namespace Botan { -namespace { - -/************************************************* -* Pthread Mutex * -*************************************************/ -class Pthread_Mutex : public Mutex - { - public: - void lock() - { - if(pthread_mutex_lock(&mutex) != 0) - throw Exception("Pthread_Mutex::lock: Error occured"); - } - - void unlock() - { - if(pthread_mutex_unlock(&mutex) != 0) - throw Exception("Pthread_Mutex::unlock: Error occured"); - } - - Pthread_Mutex() - { - if(pthread_mutex_init(&mutex, 0) != 0) - throw Exception("Pthread_Mutex: initialization failed"); - } - - ~Pthread_Mutex() - { - if(pthread_mutex_destroy(&mutex) != 0) - throw Invalid_State("~Pthread_Mutex: mutex is still locked"); - } - private: - pthread_mutex_t mutex; - }; - -} - /************************************************* * Pthread Mutex Factory * *************************************************/ Mutex* Pthread_Mutex_Factory::make() { + + class Pthread_Mutex : public Mutex + { + public: + void lock() + { + if(pthread_mutex_lock(&mutex) != 0) + throw Exception("Pthread_Mutex::lock: Error occured"); + } + + void unlock() + { + if(pthread_mutex_unlock(&mutex) != 0) + throw Exception("Pthread_Mutex::unlock: Error occured"); + } + + Pthread_Mutex() + { + if(pthread_mutex_init(&mutex, 0) != 0) + throw Exception("Pthread_Mutex: initialization failed"); + } + + ~Pthread_Mutex() + { + if(pthread_mutex_destroy(&mutex) != 0) + throw Invalid_State("~Pthread_Mutex: mutex is still locked"); + } + private: + pthread_mutex_t mutex; + }; + return new Pthread_Mutex(); } |