From 99e8c1a20700631103ec20386f8080eeee4df588 Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 1 Apr 2009 15:43:27 +0000 Subject: Remove the mutex classes in favor of C++0x's std::mutex and std::lock_guard --- Attic/mutex/noop_mutex/mux_noop.cpp | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Attic/mutex/noop_mutex/mux_noop.cpp (limited to 'Attic/mutex/noop_mutex/mux_noop.cpp') diff --git a/Attic/mutex/noop_mutex/mux_noop.cpp b/Attic/mutex/noop_mutex/mux_noop.cpp new file mode 100644 index 000000000..5c45084fe --- /dev/null +++ b/Attic/mutex/noop_mutex/mux_noop.cpp @@ -0,0 +1,50 @@ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include + +namespace Botan { + +/* +* No-Op Mutex Factory +*/ +Mutex* Noop_Mutex_Factory::make() + { + class Noop_Mutex : public Mutex + { + public: + class Mutex_State_Error : public Internal_Error + { + public: + Mutex_State_Error(const std::string& where) : + Internal_Error("Noop_Mutex::" + where + ": " + + "Mutex is already " + where + "ed") {} + }; + + void lock() + { + if(locked) + throw Mutex_State_Error("lock"); + locked = true; + } + + void unlock() + { + if(!locked) + throw Mutex_State_Error("unlock"); + locked = false; + } + + Noop_Mutex() { locked = false; } + private: + bool locked; + }; + + return new Noop_Mutex; + } + +} -- cgit v1.2.3 From 7f715b77711f55d9e30f232ff32001fe9e375a56 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 3 Jul 2009 04:45:58 +0000 Subject: Move mutex from Attic to src to deal with merge conflict --- Attic/mutex/noop_mutex/info.txt | 10 ----- Attic/mutex/noop_mutex/mux_noop.cpp | 50 ------------------------ Attic/mutex/noop_mutex/mux_noop.h | 26 ------------- Attic/mutex/pthreads/info.txt | 29 -------------- Attic/mutex/pthreads/mux_pthr.cpp | 58 ---------------------------- Attic/mutex/pthreads/mux_pthr.h | 26 ------------- Attic/mutex/qt_mutex/info.txt | 18 --------- Attic/mutex/qt_mutex/mux_qt.cpp | 35 ----------------- Attic/mutex/qt_mutex/mux_qt.h | 27 ------------- Attic/mutex/win32_crit_section/info.txt | 17 -------- Attic/mutex/win32_crit_section/mux_win32.cpp | 34 ---------------- Attic/mutex/win32_crit_section/mux_win32.h | 26 ------------- src/mutex/noop_mutex/info.txt | 10 +++++ src/mutex/noop_mutex/mux_noop.cpp | 50 ++++++++++++++++++++++++ src/mutex/noop_mutex/mux_noop.h | 26 +++++++++++++ src/mutex/pthreads/info.txt | 29 ++++++++++++++ src/mutex/pthreads/mux_pthr.cpp | 58 ++++++++++++++++++++++++++++ src/mutex/pthreads/mux_pthr.h | 26 +++++++++++++ src/mutex/qt_mutex/info.txt | 18 +++++++++ src/mutex/qt_mutex/mux_qt.cpp | 35 +++++++++++++++++ src/mutex/qt_mutex/mux_qt.h | 27 +++++++++++++ src/mutex/win32_crit_section/info.txt | 17 ++++++++ src/mutex/win32_crit_section/mux_win32.cpp | 34 ++++++++++++++++ src/mutex/win32_crit_section/mux_win32.h | 26 +++++++++++++ 24 files changed, 356 insertions(+), 356 deletions(-) delete mode 100644 Attic/mutex/noop_mutex/info.txt delete mode 100644 Attic/mutex/noop_mutex/mux_noop.cpp delete mode 100644 Attic/mutex/noop_mutex/mux_noop.h delete mode 100644 Attic/mutex/pthreads/info.txt delete mode 100644 Attic/mutex/pthreads/mux_pthr.cpp delete mode 100644 Attic/mutex/pthreads/mux_pthr.h delete mode 100644 Attic/mutex/qt_mutex/info.txt delete mode 100644 Attic/mutex/qt_mutex/mux_qt.cpp delete mode 100644 Attic/mutex/qt_mutex/mux_qt.h delete mode 100644 Attic/mutex/win32_crit_section/info.txt delete mode 100644 Attic/mutex/win32_crit_section/mux_win32.cpp delete mode 100644 Attic/mutex/win32_crit_section/mux_win32.h create mode 100644 src/mutex/noop_mutex/info.txt create mode 100644 src/mutex/noop_mutex/mux_noop.cpp create mode 100644 src/mutex/noop_mutex/mux_noop.h create mode 100644 src/mutex/pthreads/info.txt create mode 100644 src/mutex/pthreads/mux_pthr.cpp create mode 100644 src/mutex/pthreads/mux_pthr.h create mode 100644 src/mutex/qt_mutex/info.txt create mode 100644 src/mutex/qt_mutex/mux_qt.cpp create mode 100644 src/mutex/qt_mutex/mux_qt.h create mode 100644 src/mutex/win32_crit_section/info.txt create mode 100644 src/mutex/win32_crit_section/mux_win32.cpp create mode 100644 src/mutex/win32_crit_section/mux_win32.h (limited to 'Attic/mutex/noop_mutex/mux_noop.cpp') diff --git a/Attic/mutex/noop_mutex/info.txt b/Attic/mutex/noop_mutex/info.txt deleted file mode 100644 index 1f49f5e1c..000000000 --- a/Attic/mutex/noop_mutex/info.txt +++ /dev/null @@ -1,10 +0,0 @@ -realname "No-Op Mutex" - -load_on auto - -define MUTEX_NOOP - - -mux_noop.cpp -mux_noop.h - diff --git a/Attic/mutex/noop_mutex/mux_noop.cpp b/Attic/mutex/noop_mutex/mux_noop.cpp deleted file mode 100644 index 5c45084fe..000000000 --- a/Attic/mutex/noop_mutex/mux_noop.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -* No-Op Mutex Factory -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include - -namespace Botan { - -/* -* No-Op Mutex Factory -*/ -Mutex* Noop_Mutex_Factory::make() - { - class Noop_Mutex : public Mutex - { - public: - class Mutex_State_Error : public Internal_Error - { - public: - Mutex_State_Error(const std::string& where) : - Internal_Error("Noop_Mutex::" + where + ": " + - "Mutex is already " + where + "ed") {} - }; - - void lock() - { - if(locked) - throw Mutex_State_Error("lock"); - locked = true; - } - - void unlock() - { - if(!locked) - throw Mutex_State_Error("unlock"); - locked = false; - } - - Noop_Mutex() { locked = false; } - private: - bool locked; - }; - - return new Noop_Mutex; - } - -} diff --git a/Attic/mutex/noop_mutex/mux_noop.h b/Attic/mutex/noop_mutex/mux_noop.h deleted file mode 100644 index 94201cb7c..000000000 --- a/Attic/mutex/noop_mutex/mux_noop.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* No-Op Mutex Factory -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_NOOP_MUTEX_FACTORY_H__ -#define BOTAN_NOOP_MUTEX_FACTORY_H__ - -#include - -namespace Botan { - -/* -* No-Op Mutex Factory -*/ -class BOTAN_DLL Noop_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; - -} - -#endif diff --git a/Attic/mutex/pthreads/info.txt b/Attic/mutex/pthreads/info.txt deleted file mode 100644 index 88de70de0..000000000 --- a/Attic/mutex/pthreads/info.txt +++ /dev/null @@ -1,29 +0,0 @@ -realname "Pthread Mutex" - -define MUTEX_PTHREAD - -load_on auto - - -mux_pthr.cpp -mux_pthr.h - - - -all!qnx,freebsd,openbsd,netbsd -> pthread - - - -aix -cygwin -darwin -freebsd -hpux -irix -linux -netbsd -openbsd -qnx -solaris -tru64 - diff --git a/Attic/mutex/pthreads/mux_pthr.cpp b/Attic/mutex/pthreads/mux_pthr.cpp deleted file mode 100644 index 9f1d9816e..000000000 --- a/Attic/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 -#include - -#ifndef _POSIX_C_SOURCE - #define _POSIX_C_SOURCE 199506 -#endif - -#include - -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(); - } - -} diff --git a/Attic/mutex/pthreads/mux_pthr.h b/Attic/mutex/pthreads/mux_pthr.h deleted file mode 100644 index 118853947..000000000 --- a/Attic/mutex/pthreads/mux_pthr.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Pthread Mutex -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_PTHREAD_H__ -#define BOTAN_MUTEX_PTHREAD_H__ - -#include - -namespace Botan { - -/* -* Pthread Mutex Factory -*/ -class BOTAN_DLL Pthread_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; - -} - -#endif diff --git a/Attic/mutex/qt_mutex/info.txt b/Attic/mutex/qt_mutex/info.txt deleted file mode 100644 index a21108c79..000000000 --- a/Attic/mutex/qt_mutex/info.txt +++ /dev/null @@ -1,18 +0,0 @@ -realname "Qt Mutex" - -define MUTEX_QT - -note "You'll probably have to add -I/-L flags to the Makefile to find Qt" - -load_on request - - -mux_qt.cpp -mux_qt.h - - -# I think we want to always use qt-mt, not qt -- not much point in supporting -# mutexes in a single threaded application, after all. - -all -> qt-mt - diff --git a/Attic/mutex/qt_mutex/mux_qt.cpp b/Attic/mutex/qt_mutex/mux_qt.cpp deleted file mode 100644 index 0f670c8b4..000000000 --- a/Attic/mutex/qt_mutex/mux_qt.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -* Qt Thread Mutex -* (C) 2004-2007 Justin Karneges -* 2004-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include -#include - -#if !defined(QT_THREAD_SUPPORT) - #error Your version of Qt does not support threads or mutexes -#endif - -namespace Botan { - -/* -* Qt Mutex Factory -*/ -Mutex* Qt_Mutex_Factory::make() - { - class Qt_Mutex : public Mutex - { - public: - void lock() { mutex.lock(); } - void unlock() { mutex.unlock(); } - private: - QMutex mutex; - }; - - return new Qt_Mutex(); - } - -} diff --git a/Attic/mutex/qt_mutex/mux_qt.h b/Attic/mutex/qt_mutex/mux_qt.h deleted file mode 100644 index 5aed77f4b..000000000 --- a/Attic/mutex/qt_mutex/mux_qt.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -* Qt Mutex -* (C) 2004-2007 Justin Karneges -* 2004-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_QT_H__ -#define BOTAN_MUTEX_QT_H__ - -#include - -namespace Botan { - -/* -* Qt Mutex -*/ -class BOTAN_DLL Qt_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; - -} - -#endif diff --git a/Attic/mutex/win32_crit_section/info.txt b/Attic/mutex/win32_crit_section/info.txt deleted file mode 100644 index a2d339c3b..000000000 --- a/Attic/mutex/win32_crit_section/info.txt +++ /dev/null @@ -1,17 +0,0 @@ -realname "Win32 Mutex" - -define MUTEX_WIN32 -modset win32 - -load_on auto - - -mux_win32.cpp -mux_win32.h - - - -cygwin -windows -mingw - diff --git a/Attic/mutex/win32_crit_section/mux_win32.cpp b/Attic/mutex/win32_crit_section/mux_win32.cpp deleted file mode 100644 index 2a967892b..000000000 --- a/Attic/mutex/win32_crit_section/mux_win32.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -* Win32 Mutex -* (C) 2006 Luca Piccarreta -* 2006-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include -#include - -namespace Botan { - -/* -* Win32 Mutex Factory -*/ -Mutex* Win32_Mutex_Factory::make() - { - class Win32_Mutex : public Mutex - { - public: - void lock() { EnterCriticalSection(&mutex); } - void unlock() { LeaveCriticalSection(&mutex); } - - Win32_Mutex() { InitializeCriticalSection(&mutex); } - ~Win32_Mutex() { DeleteCriticalSection(&mutex); } - private: - CRITICAL_SECTION mutex; - }; - - return new Win32_Mutex(); - } - -} diff --git a/Attic/mutex/win32_crit_section/mux_win32.h b/Attic/mutex/win32_crit_section/mux_win32.h deleted file mode 100644 index a91850e71..000000000 --- a/Attic/mutex/win32_crit_section/mux_win32.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Win32 Mutex -* (C) 2006 Luca Piccarreta -* 2006-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_WIN32_H__ -#define BOTAN_MUTEX_WIN32_H__ - -#include - -namespace Botan { - -/* -* Win32 Mutex Factory -*/ -class BOTAN_DLL Win32_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; -} - -#endif diff --git a/src/mutex/noop_mutex/info.txt b/src/mutex/noop_mutex/info.txt new file mode 100644 index 000000000..1f49f5e1c --- /dev/null +++ b/src/mutex/noop_mutex/info.txt @@ -0,0 +1,10 @@ +realname "No-Op Mutex" + +load_on auto + +define MUTEX_NOOP + + +mux_noop.cpp +mux_noop.h + diff --git a/src/mutex/noop_mutex/mux_noop.cpp b/src/mutex/noop_mutex/mux_noop.cpp new file mode 100644 index 000000000..5c45084fe --- /dev/null +++ b/src/mutex/noop_mutex/mux_noop.cpp @@ -0,0 +1,50 @@ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include + +namespace Botan { + +/* +* No-Op Mutex Factory +*/ +Mutex* Noop_Mutex_Factory::make() + { + class Noop_Mutex : public Mutex + { + public: + class Mutex_State_Error : public Internal_Error + { + public: + Mutex_State_Error(const std::string& where) : + Internal_Error("Noop_Mutex::" + where + ": " + + "Mutex is already " + where + "ed") {} + }; + + void lock() + { + if(locked) + throw Mutex_State_Error("lock"); + locked = true; + } + + void unlock() + { + if(!locked) + throw Mutex_State_Error("unlock"); + locked = false; + } + + Noop_Mutex() { locked = false; } + private: + bool locked; + }; + + return new Noop_Mutex; + } + +} diff --git a/src/mutex/noop_mutex/mux_noop.h b/src/mutex/noop_mutex/mux_noop.h new file mode 100644 index 000000000..94201cb7c --- /dev/null +++ b/src/mutex/noop_mutex/mux_noop.h @@ -0,0 +1,26 @@ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_NOOP_MUTEX_FACTORY_H__ +#define BOTAN_NOOP_MUTEX_FACTORY_H__ + +#include + +namespace Botan { + +/* +* No-Op Mutex Factory +*/ +class BOTAN_DLL Noop_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; + +} + +#endif diff --git a/src/mutex/pthreads/info.txt b/src/mutex/pthreads/info.txt new file mode 100644 index 000000000..88de70de0 --- /dev/null +++ b/src/mutex/pthreads/info.txt @@ -0,0 +1,29 @@ +realname "Pthread Mutex" + +define MUTEX_PTHREAD + +load_on auto + + +mux_pthr.cpp +mux_pthr.h + + + +all!qnx,freebsd,openbsd,netbsd -> pthread + + + +aix +cygwin +darwin +freebsd +hpux +irix +linux +netbsd +openbsd +qnx +solaris +tru64 + diff --git a/src/mutex/pthreads/mux_pthr.cpp b/src/mutex/pthreads/mux_pthr.cpp new file mode 100644 index 000000000..9f1d9816e --- /dev/null +++ b/src/mutex/pthreads/mux_pthr.cpp @@ -0,0 +1,58 @@ +/* +* Pthread Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include + +#ifndef _POSIX_C_SOURCE + #define _POSIX_C_SOURCE 199506 +#endif + +#include + +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(); + } + +} diff --git a/src/mutex/pthreads/mux_pthr.h b/src/mutex/pthreads/mux_pthr.h new file mode 100644 index 000000000..118853947 --- /dev/null +++ b/src/mutex/pthreads/mux_pthr.h @@ -0,0 +1,26 @@ +/* +* Pthread Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_PTHREAD_H__ +#define BOTAN_MUTEX_PTHREAD_H__ + +#include + +namespace Botan { + +/* +* Pthread Mutex Factory +*/ +class BOTAN_DLL Pthread_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; + +} + +#endif diff --git a/src/mutex/qt_mutex/info.txt b/src/mutex/qt_mutex/info.txt new file mode 100644 index 000000000..a21108c79 --- /dev/null +++ b/src/mutex/qt_mutex/info.txt @@ -0,0 +1,18 @@ +realname "Qt Mutex" + +define MUTEX_QT + +note "You'll probably have to add -I/-L flags to the Makefile to find Qt" + +load_on request + + +mux_qt.cpp +mux_qt.h + + +# I think we want to always use qt-mt, not qt -- not much point in supporting +# mutexes in a single threaded application, after all. + +all -> qt-mt + diff --git a/src/mutex/qt_mutex/mux_qt.cpp b/src/mutex/qt_mutex/mux_qt.cpp new file mode 100644 index 000000000..0f670c8b4 --- /dev/null +++ b/src/mutex/qt_mutex/mux_qt.cpp @@ -0,0 +1,35 @@ +/* +* Qt Thread Mutex +* (C) 2004-2007 Justin Karneges +* 2004-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include + +#if !defined(QT_THREAD_SUPPORT) + #error Your version of Qt does not support threads or mutexes +#endif + +namespace Botan { + +/* +* Qt Mutex Factory +*/ +Mutex* Qt_Mutex_Factory::make() + { + class Qt_Mutex : public Mutex + { + public: + void lock() { mutex.lock(); } + void unlock() { mutex.unlock(); } + private: + QMutex mutex; + }; + + return new Qt_Mutex(); + } + +} diff --git a/src/mutex/qt_mutex/mux_qt.h b/src/mutex/qt_mutex/mux_qt.h new file mode 100644 index 000000000..5aed77f4b --- /dev/null +++ b/src/mutex/qt_mutex/mux_qt.h @@ -0,0 +1,27 @@ +/* +* Qt Mutex +* (C) 2004-2007 Justin Karneges +* 2004-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_QT_H__ +#define BOTAN_MUTEX_QT_H__ + +#include + +namespace Botan { + +/* +* Qt Mutex +*/ +class BOTAN_DLL Qt_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; + +} + +#endif diff --git a/src/mutex/win32_crit_section/info.txt b/src/mutex/win32_crit_section/info.txt new file mode 100644 index 000000000..a2d339c3b --- /dev/null +++ b/src/mutex/win32_crit_section/info.txt @@ -0,0 +1,17 @@ +realname "Win32 Mutex" + +define MUTEX_WIN32 +modset win32 + +load_on auto + + +mux_win32.cpp +mux_win32.h + + + +cygwin +windows +mingw + diff --git a/src/mutex/win32_crit_section/mux_win32.cpp b/src/mutex/win32_crit_section/mux_win32.cpp new file mode 100644 index 000000000..2a967892b --- /dev/null +++ b/src/mutex/win32_crit_section/mux_win32.cpp @@ -0,0 +1,34 @@ +/* +* Win32 Mutex +* (C) 2006 Luca Piccarreta +* 2006-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include + +namespace Botan { + +/* +* Win32 Mutex Factory +*/ +Mutex* Win32_Mutex_Factory::make() + { + class Win32_Mutex : public Mutex + { + public: + void lock() { EnterCriticalSection(&mutex); } + void unlock() { LeaveCriticalSection(&mutex); } + + Win32_Mutex() { InitializeCriticalSection(&mutex); } + ~Win32_Mutex() { DeleteCriticalSection(&mutex); } + private: + CRITICAL_SECTION mutex; + }; + + return new Win32_Mutex(); + } + +} diff --git a/src/mutex/win32_crit_section/mux_win32.h b/src/mutex/win32_crit_section/mux_win32.h new file mode 100644 index 000000000..a91850e71 --- /dev/null +++ b/src/mutex/win32_crit_section/mux_win32.h @@ -0,0 +1,26 @@ +/* +* Win32 Mutex +* (C) 2006 Luca Piccarreta +* 2006-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_WIN32_H__ +#define BOTAN_MUTEX_WIN32_H__ + +#include + +namespace Botan { + +/* +* Win32 Mutex Factory +*/ +class BOTAN_DLL Win32_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; +} + +#endif -- cgit v1.2.3 From b438a3c6d08893ca77a1d18baef1b02e955eccf8 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 3 Jul 2009 04:47:49 +0000 Subject: Move mutex directory back to the Attic --- Attic/mutex/info.txt | 9 +++++ Attic/mutex/mutex.h | 56 +++++++++++++++++++++++++++ Attic/mutex/noop_mutex/info.txt | 10 +++++ Attic/mutex/noop_mutex/mux_noop.cpp | 50 ++++++++++++++++++++++++ Attic/mutex/noop_mutex/mux_noop.h | 26 +++++++++++++ Attic/mutex/pthreads/info.txt | 29 ++++++++++++++ Attic/mutex/pthreads/mux_pthr.cpp | 58 ++++++++++++++++++++++++++++ Attic/mutex/pthreads/mux_pthr.h | 26 +++++++++++++ Attic/mutex/qt_mutex/info.txt | 18 +++++++++ Attic/mutex/qt_mutex/mux_qt.cpp | 35 +++++++++++++++++ Attic/mutex/qt_mutex/mux_qt.h | 27 +++++++++++++ Attic/mutex/win32_crit_section/info.txt | 17 ++++++++ Attic/mutex/win32_crit_section/mux_win32.cpp | 34 ++++++++++++++++ Attic/mutex/win32_crit_section/mux_win32.h | 26 +++++++++++++ src/mutex/info.txt | 9 ----- src/mutex/mutex.h | 56 --------------------------- src/mutex/noop_mutex/info.txt | 10 ----- src/mutex/noop_mutex/mux_noop.cpp | 50 ------------------------ src/mutex/noop_mutex/mux_noop.h | 26 ------------- src/mutex/pthreads/info.txt | 29 -------------- src/mutex/pthreads/mux_pthr.cpp | 58 ---------------------------- src/mutex/pthreads/mux_pthr.h | 26 ------------- src/mutex/qt_mutex/info.txt | 18 --------- src/mutex/qt_mutex/mux_qt.cpp | 35 ----------------- src/mutex/qt_mutex/mux_qt.h | 27 ------------- src/mutex/win32_crit_section/info.txt | 17 -------- src/mutex/win32_crit_section/mux_win32.cpp | 34 ---------------- src/mutex/win32_crit_section/mux_win32.h | 26 ------------- 28 files changed, 421 insertions(+), 421 deletions(-) create mode 100644 Attic/mutex/info.txt create mode 100644 Attic/mutex/mutex.h create mode 100644 Attic/mutex/noop_mutex/info.txt create mode 100644 Attic/mutex/noop_mutex/mux_noop.cpp create mode 100644 Attic/mutex/noop_mutex/mux_noop.h create mode 100644 Attic/mutex/pthreads/info.txt create mode 100644 Attic/mutex/pthreads/mux_pthr.cpp create mode 100644 Attic/mutex/pthreads/mux_pthr.h create mode 100644 Attic/mutex/qt_mutex/info.txt create mode 100644 Attic/mutex/qt_mutex/mux_qt.cpp create mode 100644 Attic/mutex/qt_mutex/mux_qt.h create mode 100644 Attic/mutex/win32_crit_section/info.txt create mode 100644 Attic/mutex/win32_crit_section/mux_win32.cpp create mode 100644 Attic/mutex/win32_crit_section/mux_win32.h delete mode 100644 src/mutex/info.txt delete mode 100644 src/mutex/mutex.h delete mode 100644 src/mutex/noop_mutex/info.txt delete mode 100644 src/mutex/noop_mutex/mux_noop.cpp delete mode 100644 src/mutex/noop_mutex/mux_noop.h delete mode 100644 src/mutex/pthreads/info.txt delete mode 100644 src/mutex/pthreads/mux_pthr.cpp delete mode 100644 src/mutex/pthreads/mux_pthr.h delete mode 100644 src/mutex/qt_mutex/info.txt delete mode 100644 src/mutex/qt_mutex/mux_qt.cpp delete mode 100644 src/mutex/qt_mutex/mux_qt.h delete mode 100644 src/mutex/win32_crit_section/info.txt delete mode 100644 src/mutex/win32_crit_section/mux_win32.cpp delete mode 100644 src/mutex/win32_crit_section/mux_win32.h (limited to 'Attic/mutex/noop_mutex/mux_noop.cpp') diff --git a/Attic/mutex/info.txt b/Attic/mutex/info.txt new file mode 100644 index 000000000..ff79bf753 --- /dev/null +++ b/Attic/mutex/info.txt @@ -0,0 +1,9 @@ +realname "Mutex Wrappers" + +define MUTEX_WRAPPERS + +load_on auto + + +mutex.h + diff --git a/Attic/mutex/mutex.h b/Attic/mutex/mutex.h new file mode 100644 index 000000000..a04ff83c9 --- /dev/null +++ b/Attic/mutex/mutex.h @@ -0,0 +1,56 @@ +/* +* Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_H__ +#define BOTAN_MUTEX_H__ + +#include + +namespace Botan { + +/* +* Mutex Base Class +*/ +class BOTAN_DLL Mutex + { + public: + virtual void lock() = 0; + virtual void unlock() = 0; + virtual ~Mutex() {} + }; + +/* +* Mutex Factory +*/ +class BOTAN_DLL Mutex_Factory + { + public: + virtual Mutex* make() = 0; + virtual ~Mutex_Factory() {} + }; + +/* +* Mutex Holding Class +*/ +class BOTAN_DLL Mutex_Holder + { + public: + Mutex_Holder(Mutex* m) : mux(m) + { + if(!mux) + throw Invalid_Argument("Mutex_Holder: Argument was NULL"); + mux->lock(); + } + + ~Mutex_Holder() { mux->unlock(); } + private: + Mutex* mux; + }; + +} + +#endif diff --git a/Attic/mutex/noop_mutex/info.txt b/Attic/mutex/noop_mutex/info.txt new file mode 100644 index 000000000..1f49f5e1c --- /dev/null +++ b/Attic/mutex/noop_mutex/info.txt @@ -0,0 +1,10 @@ +realname "No-Op Mutex" + +load_on auto + +define MUTEX_NOOP + + +mux_noop.cpp +mux_noop.h + diff --git a/Attic/mutex/noop_mutex/mux_noop.cpp b/Attic/mutex/noop_mutex/mux_noop.cpp new file mode 100644 index 000000000..5c45084fe --- /dev/null +++ b/Attic/mutex/noop_mutex/mux_noop.cpp @@ -0,0 +1,50 @@ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include + +namespace Botan { + +/* +* No-Op Mutex Factory +*/ +Mutex* Noop_Mutex_Factory::make() + { + class Noop_Mutex : public Mutex + { + public: + class Mutex_State_Error : public Internal_Error + { + public: + Mutex_State_Error(const std::string& where) : + Internal_Error("Noop_Mutex::" + where + ": " + + "Mutex is already " + where + "ed") {} + }; + + void lock() + { + if(locked) + throw Mutex_State_Error("lock"); + locked = true; + } + + void unlock() + { + if(!locked) + throw Mutex_State_Error("unlock"); + locked = false; + } + + Noop_Mutex() { locked = false; } + private: + bool locked; + }; + + return new Noop_Mutex; + } + +} diff --git a/Attic/mutex/noop_mutex/mux_noop.h b/Attic/mutex/noop_mutex/mux_noop.h new file mode 100644 index 000000000..94201cb7c --- /dev/null +++ b/Attic/mutex/noop_mutex/mux_noop.h @@ -0,0 +1,26 @@ +/* +* No-Op Mutex Factory +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_NOOP_MUTEX_FACTORY_H__ +#define BOTAN_NOOP_MUTEX_FACTORY_H__ + +#include + +namespace Botan { + +/* +* No-Op Mutex Factory +*/ +class BOTAN_DLL Noop_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; + +} + +#endif diff --git a/Attic/mutex/pthreads/info.txt b/Attic/mutex/pthreads/info.txt new file mode 100644 index 000000000..88de70de0 --- /dev/null +++ b/Attic/mutex/pthreads/info.txt @@ -0,0 +1,29 @@ +realname "Pthread Mutex" + +define MUTEX_PTHREAD + +load_on auto + + +mux_pthr.cpp +mux_pthr.h + + + +all!qnx,freebsd,openbsd,netbsd -> pthread + + + +aix +cygwin +darwin +freebsd +hpux +irix +linux +netbsd +openbsd +qnx +solaris +tru64 + diff --git a/Attic/mutex/pthreads/mux_pthr.cpp b/Attic/mutex/pthreads/mux_pthr.cpp new file mode 100644 index 000000000..9f1d9816e --- /dev/null +++ b/Attic/mutex/pthreads/mux_pthr.cpp @@ -0,0 +1,58 @@ +/* +* Pthread Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include + +#ifndef _POSIX_C_SOURCE + #define _POSIX_C_SOURCE 199506 +#endif + +#include + +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(); + } + +} diff --git a/Attic/mutex/pthreads/mux_pthr.h b/Attic/mutex/pthreads/mux_pthr.h new file mode 100644 index 000000000..118853947 --- /dev/null +++ b/Attic/mutex/pthreads/mux_pthr.h @@ -0,0 +1,26 @@ +/* +* Pthread Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_PTHREAD_H__ +#define BOTAN_MUTEX_PTHREAD_H__ + +#include + +namespace Botan { + +/* +* Pthread Mutex Factory +*/ +class BOTAN_DLL Pthread_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; + +} + +#endif diff --git a/Attic/mutex/qt_mutex/info.txt b/Attic/mutex/qt_mutex/info.txt new file mode 100644 index 000000000..a21108c79 --- /dev/null +++ b/Attic/mutex/qt_mutex/info.txt @@ -0,0 +1,18 @@ +realname "Qt Mutex" + +define MUTEX_QT + +note "You'll probably have to add -I/-L flags to the Makefile to find Qt" + +load_on request + + +mux_qt.cpp +mux_qt.h + + +# I think we want to always use qt-mt, not qt -- not much point in supporting +# mutexes in a single threaded application, after all. + +all -> qt-mt + diff --git a/Attic/mutex/qt_mutex/mux_qt.cpp b/Attic/mutex/qt_mutex/mux_qt.cpp new file mode 100644 index 000000000..0f670c8b4 --- /dev/null +++ b/Attic/mutex/qt_mutex/mux_qt.cpp @@ -0,0 +1,35 @@ +/* +* Qt Thread Mutex +* (C) 2004-2007 Justin Karneges +* 2004-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include + +#if !defined(QT_THREAD_SUPPORT) + #error Your version of Qt does not support threads or mutexes +#endif + +namespace Botan { + +/* +* Qt Mutex Factory +*/ +Mutex* Qt_Mutex_Factory::make() + { + class Qt_Mutex : public Mutex + { + public: + void lock() { mutex.lock(); } + void unlock() { mutex.unlock(); } + private: + QMutex mutex; + }; + + return new Qt_Mutex(); + } + +} diff --git a/Attic/mutex/qt_mutex/mux_qt.h b/Attic/mutex/qt_mutex/mux_qt.h new file mode 100644 index 000000000..5aed77f4b --- /dev/null +++ b/Attic/mutex/qt_mutex/mux_qt.h @@ -0,0 +1,27 @@ +/* +* Qt Mutex +* (C) 2004-2007 Justin Karneges +* 2004-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_QT_H__ +#define BOTAN_MUTEX_QT_H__ + +#include + +namespace Botan { + +/* +* Qt Mutex +*/ +class BOTAN_DLL Qt_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; + +} + +#endif diff --git a/Attic/mutex/win32_crit_section/info.txt b/Attic/mutex/win32_crit_section/info.txt new file mode 100644 index 000000000..a2d339c3b --- /dev/null +++ b/Attic/mutex/win32_crit_section/info.txt @@ -0,0 +1,17 @@ +realname "Win32 Mutex" + +define MUTEX_WIN32 +modset win32 + +load_on auto + + +mux_win32.cpp +mux_win32.h + + + +cygwin +windows +mingw + diff --git a/Attic/mutex/win32_crit_section/mux_win32.cpp b/Attic/mutex/win32_crit_section/mux_win32.cpp new file mode 100644 index 000000000..2a967892b --- /dev/null +++ b/Attic/mutex/win32_crit_section/mux_win32.cpp @@ -0,0 +1,34 @@ +/* +* Win32 Mutex +* (C) 2006 Luca Piccarreta +* 2006-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include +#include + +namespace Botan { + +/* +* Win32 Mutex Factory +*/ +Mutex* Win32_Mutex_Factory::make() + { + class Win32_Mutex : public Mutex + { + public: + void lock() { EnterCriticalSection(&mutex); } + void unlock() { LeaveCriticalSection(&mutex); } + + Win32_Mutex() { InitializeCriticalSection(&mutex); } + ~Win32_Mutex() { DeleteCriticalSection(&mutex); } + private: + CRITICAL_SECTION mutex; + }; + + return new Win32_Mutex(); + } + +} diff --git a/Attic/mutex/win32_crit_section/mux_win32.h b/Attic/mutex/win32_crit_section/mux_win32.h new file mode 100644 index 000000000..a91850e71 --- /dev/null +++ b/Attic/mutex/win32_crit_section/mux_win32.h @@ -0,0 +1,26 @@ +/* +* Win32 Mutex +* (C) 2006 Luca Piccarreta +* 2006-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_WIN32_H__ +#define BOTAN_MUTEX_WIN32_H__ + +#include + +namespace Botan { + +/* +* Win32 Mutex Factory +*/ +class BOTAN_DLL Win32_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; +} + +#endif diff --git a/src/mutex/info.txt b/src/mutex/info.txt deleted file mode 100644 index ff79bf753..000000000 --- a/src/mutex/info.txt +++ /dev/null @@ -1,9 +0,0 @@ -realname "Mutex Wrappers" - -define MUTEX_WRAPPERS - -load_on auto - - -mutex.h - diff --git a/src/mutex/mutex.h b/src/mutex/mutex.h deleted file mode 100644 index a04ff83c9..000000000 --- a/src/mutex/mutex.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -* Mutex -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_H__ -#define BOTAN_MUTEX_H__ - -#include - -namespace Botan { - -/* -* Mutex Base Class -*/ -class BOTAN_DLL Mutex - { - public: - virtual void lock() = 0; - virtual void unlock() = 0; - virtual ~Mutex() {} - }; - -/* -* Mutex Factory -*/ -class BOTAN_DLL Mutex_Factory - { - public: - virtual Mutex* make() = 0; - virtual ~Mutex_Factory() {} - }; - -/* -* Mutex Holding Class -*/ -class BOTAN_DLL Mutex_Holder - { - public: - Mutex_Holder(Mutex* m) : mux(m) - { - if(!mux) - throw Invalid_Argument("Mutex_Holder: Argument was NULL"); - mux->lock(); - } - - ~Mutex_Holder() { mux->unlock(); } - private: - Mutex* mux; - }; - -} - -#endif diff --git a/src/mutex/noop_mutex/info.txt b/src/mutex/noop_mutex/info.txt deleted file mode 100644 index 1f49f5e1c..000000000 --- a/src/mutex/noop_mutex/info.txt +++ /dev/null @@ -1,10 +0,0 @@ -realname "No-Op Mutex" - -load_on auto - -define MUTEX_NOOP - - -mux_noop.cpp -mux_noop.h - diff --git a/src/mutex/noop_mutex/mux_noop.cpp b/src/mutex/noop_mutex/mux_noop.cpp deleted file mode 100644 index 5c45084fe..000000000 --- a/src/mutex/noop_mutex/mux_noop.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* -* No-Op Mutex Factory -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include - -namespace Botan { - -/* -* No-Op Mutex Factory -*/ -Mutex* Noop_Mutex_Factory::make() - { - class Noop_Mutex : public Mutex - { - public: - class Mutex_State_Error : public Internal_Error - { - public: - Mutex_State_Error(const std::string& where) : - Internal_Error("Noop_Mutex::" + where + ": " + - "Mutex is already " + where + "ed") {} - }; - - void lock() - { - if(locked) - throw Mutex_State_Error("lock"); - locked = true; - } - - void unlock() - { - if(!locked) - throw Mutex_State_Error("unlock"); - locked = false; - } - - Noop_Mutex() { locked = false; } - private: - bool locked; - }; - - return new Noop_Mutex; - } - -} diff --git a/src/mutex/noop_mutex/mux_noop.h b/src/mutex/noop_mutex/mux_noop.h deleted file mode 100644 index 94201cb7c..000000000 --- a/src/mutex/noop_mutex/mux_noop.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* No-Op Mutex Factory -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_NOOP_MUTEX_FACTORY_H__ -#define BOTAN_NOOP_MUTEX_FACTORY_H__ - -#include - -namespace Botan { - -/* -* No-Op Mutex Factory -*/ -class BOTAN_DLL Noop_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; - -} - -#endif diff --git a/src/mutex/pthreads/info.txt b/src/mutex/pthreads/info.txt deleted file mode 100644 index 88de70de0..000000000 --- a/src/mutex/pthreads/info.txt +++ /dev/null @@ -1,29 +0,0 @@ -realname "Pthread Mutex" - -define MUTEX_PTHREAD - -load_on auto - - -mux_pthr.cpp -mux_pthr.h - - - -all!qnx,freebsd,openbsd,netbsd -> pthread - - - -aix -cygwin -darwin -freebsd -hpux -irix -linux -netbsd -openbsd -qnx -solaris -tru64 - 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 -#include - -#ifndef _POSIX_C_SOURCE - #define _POSIX_C_SOURCE 199506 -#endif - -#include - -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(); - } - -} diff --git a/src/mutex/pthreads/mux_pthr.h b/src/mutex/pthreads/mux_pthr.h deleted file mode 100644 index 118853947..000000000 --- a/src/mutex/pthreads/mux_pthr.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Pthread Mutex -* (C) 1999-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_PTHREAD_H__ -#define BOTAN_MUTEX_PTHREAD_H__ - -#include - -namespace Botan { - -/* -* Pthread Mutex Factory -*/ -class BOTAN_DLL Pthread_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; - -} - -#endif diff --git a/src/mutex/qt_mutex/info.txt b/src/mutex/qt_mutex/info.txt deleted file mode 100644 index a21108c79..000000000 --- a/src/mutex/qt_mutex/info.txt +++ /dev/null @@ -1,18 +0,0 @@ -realname "Qt Mutex" - -define MUTEX_QT - -note "You'll probably have to add -I/-L flags to the Makefile to find Qt" - -load_on request - - -mux_qt.cpp -mux_qt.h - - -# I think we want to always use qt-mt, not qt -- not much point in supporting -# mutexes in a single threaded application, after all. - -all -> qt-mt - diff --git a/src/mutex/qt_mutex/mux_qt.cpp b/src/mutex/qt_mutex/mux_qt.cpp deleted file mode 100644 index 0f670c8b4..000000000 --- a/src/mutex/qt_mutex/mux_qt.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -* Qt Thread Mutex -* (C) 2004-2007 Justin Karneges -* 2004-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include -#include - -#if !defined(QT_THREAD_SUPPORT) - #error Your version of Qt does not support threads or mutexes -#endif - -namespace Botan { - -/* -* Qt Mutex Factory -*/ -Mutex* Qt_Mutex_Factory::make() - { - class Qt_Mutex : public Mutex - { - public: - void lock() { mutex.lock(); } - void unlock() { mutex.unlock(); } - private: - QMutex mutex; - }; - - return new Qt_Mutex(); - } - -} diff --git a/src/mutex/qt_mutex/mux_qt.h b/src/mutex/qt_mutex/mux_qt.h deleted file mode 100644 index 5aed77f4b..000000000 --- a/src/mutex/qt_mutex/mux_qt.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -* Qt Mutex -* (C) 2004-2007 Justin Karneges -* 2004-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_QT_H__ -#define BOTAN_MUTEX_QT_H__ - -#include - -namespace Botan { - -/* -* Qt Mutex -*/ -class BOTAN_DLL Qt_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; - -} - -#endif diff --git a/src/mutex/win32_crit_section/info.txt b/src/mutex/win32_crit_section/info.txt deleted file mode 100644 index a2d339c3b..000000000 --- a/src/mutex/win32_crit_section/info.txt +++ /dev/null @@ -1,17 +0,0 @@ -realname "Win32 Mutex" - -define MUTEX_WIN32 -modset win32 - -load_on auto - - -mux_win32.cpp -mux_win32.h - - - -cygwin -windows -mingw - diff --git a/src/mutex/win32_crit_section/mux_win32.cpp b/src/mutex/win32_crit_section/mux_win32.cpp deleted file mode 100644 index 2a967892b..000000000 --- a/src/mutex/win32_crit_section/mux_win32.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -* Win32 Mutex -* (C) 2006 Luca Piccarreta -* 2006-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include -#include - -namespace Botan { - -/* -* Win32 Mutex Factory -*/ -Mutex* Win32_Mutex_Factory::make() - { - class Win32_Mutex : public Mutex - { - public: - void lock() { EnterCriticalSection(&mutex); } - void unlock() { LeaveCriticalSection(&mutex); } - - Win32_Mutex() { InitializeCriticalSection(&mutex); } - ~Win32_Mutex() { DeleteCriticalSection(&mutex); } - private: - CRITICAL_SECTION mutex; - }; - - return new Win32_Mutex(); - } - -} diff --git a/src/mutex/win32_crit_section/mux_win32.h b/src/mutex/win32_crit_section/mux_win32.h deleted file mode 100644 index a91850e71..000000000 --- a/src/mutex/win32_crit_section/mux_win32.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -* Win32 Mutex -* (C) 2006 Luca Piccarreta -* 2006-2007 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#ifndef BOTAN_MUTEX_WIN32_H__ -#define BOTAN_MUTEX_WIN32_H__ - -#include - -namespace Botan { - -/* -* Win32 Mutex Factory -*/ -class BOTAN_DLL Win32_Mutex_Factory : public Mutex_Factory - { - public: - Mutex* make(); - }; -} - -#endif -- cgit v1.2.3