diff options
author | lloyd <[email protected]> | 2011-07-12 11:52:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-07-12 11:52:39 +0000 |
commit | 9e84dbf6c6ee9297f2a707f49d1cf175b6e149a5 (patch) | |
tree | e93fc28388c762d11bae0a52edcc17576a2ae1f6 /src/mutex/pthreads/mux_pthr.cpp | |
parent | 82e218500e6f305d02feecc000b43a5d9448e11a (diff) | |
parent | dcc7e959eff557811c3cf414adde096285821816 (diff) |
propagate from branch 'net.randombit.botan' (head 23a326fa36a31dd39347a8864e1f5740669a905e)
to branch 'net.randombit.botan.cxx11' (head 9d3ac8dd45f7673c85dca41968e7750acc90bdff)
Diffstat (limited to 'src/mutex/pthreads/mux_pthr.cpp')
-rw-r--r-- | src/mutex/pthreads/mux_pthr.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/mutex/pthreads/mux_pthr.cpp b/src/mutex/pthreads/mux_pthr.cpp deleted file mode 100644 index 165132239..000000000 --- a/src/mutex/pthreads/mux_pthr.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* -* Pthread Mutex -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include <botan/internal/mux_pthr.h> -#include <botan/exceptn.h> - -#ifndef _POSIX_C_SOURCE - #define _POSIX_C_SOURCE 199506 -#endif - -#include <pthread.h> - -namespace Botan { - -/* -* Pthread Mutex Factory -*/ -Mutex* Pthread_Mutex_Factory::make() - { - - class Pthread_Mutex : public Mutex - { - public: - void lock() - { - if(pthread_mutex_lock(&mutex) != 0) - throw Invalid_State("Pthread_Mutex::lock: Error occured"); - } - - void unlock() - { - if(pthread_mutex_unlock(&mutex) != 0) - throw Invalid_State("Pthread_Mutex::unlock: Error occured"); - } - - Pthread_Mutex() - { - if(pthread_mutex_init(&mutex, 0) != 0) - throw Invalid_State("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(); - } - -} |