diff options
author | lloyd <[email protected]> | 2009-04-01 15:43:27 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-04-01 15:43:27 +0000 |
commit | 99e8c1a20700631103ec20386f8080eeee4df588 (patch) | |
tree | bc3ecc536cb98a39c2707dc8eba08e3a648a5c45 /src/mutex/pthreads/mux_pthr.cpp | |
parent | 855b569d25b5810213ae7e52c04df4e5e0cf8d46 (diff) |
Remove the mutex classes in favor of C++0x's std::mutex and std::lock_guard
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 9f1d9816e..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/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 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(); - } - -} |