diff options
author | lloyd <[email protected]> | 2010-07-09 20:28:29 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-07-09 20:28:29 +0000 |
commit | 91137b44613c7ed5a12a1c64a6fd3e119828c43c (patch) | |
tree | 60d3728bc11356dc60b37859ac34f1d61138e82d /src/mutex/pthreads/mux_pthr.cpp | |
parent | a2775c5bd9f6979da3e1981cdb1dec250e274fea (diff) | |
parent | 54bac11c5d4e051f996951feb6a037b1de001329 (diff) |
propagate from branch 'net.randombit.botan' (head 161b5c0300b72baa746f101fda1e2b4a7c71818c)
to branch 'net.randombit.botan.c++0x' (head 1fc3875bb8daf4ad0e90ba66db72642203cb9984)
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(); - } - -} |