aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mux_qt/mux_qt.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-18 19:02:02 +0000
committerlloyd <[email protected]>2006-05-18 19:02:02 +0000
commit3285e451e096d16c69ee906ab46f936b20dc2eaa (patch)
tree5ecc2cfcd1bf1c6300b14fe850e732e633b3470e /modules/mux_qt/mux_qt.cpp
parentc3ae40d21245315a5bfb913820c20d0d2896522c (diff)
Change the Qt mutex to use the new Mutex_Factory abstraction
Diffstat (limited to 'modules/mux_qt/mux_qt.cpp')
-rw-r--r--modules/mux_qt/mux_qt.cpp44
1 files changed, 14 insertions, 30 deletions
diff --git a/modules/mux_qt/mux_qt.cpp b/modules/mux_qt/mux_qt.cpp
index 0d419d38a..e5c6d96ff 100644
--- a/modules/mux_qt/mux_qt.cpp
+++ b/modules/mux_qt/mux_qt.cpp
@@ -4,7 +4,6 @@
*************************************************/
#include <botan/mux_qt.h>
-#include <botan/exceptn.h>
#include <qmutex.h>
#if !defined(QT_THREAD_SUPPORT)
@@ -13,44 +12,29 @@
namespace Botan {
-/*************************************************
-* Wrapper Type for Qt Thread Mutex *
-*************************************************/
-struct mutex_wrapper
- {
- QMutex m;
- };
-
-/*************************************************
-* Constructor *
-*************************************************/
-Qt_Mutex::Qt_Mutex()
- {
- mutex = new mutex_wrapper;
- }
+namespace {
/*************************************************
-* Destructor *
+* Qt Mutex *
*************************************************/
-Qt_Mutex::~Qt_Mutex()
+class Qt_Mutex : public Mutex
{
- delete mutex;
- }
+ public:
+ void lock() { mutex.lock(); }
+ void unlock() { mutex.unlock(); }
+ private:
+ QMutex mutex;
+ };
-/*************************************************
-* Lock the Mutex *
-*************************************************/
-void Qt_Mutex::lock()
- {
- mutex->m.lock();
- }
+}
/*************************************************
-* Unlock the Mutex *
+* Qt Mutex Factory *
*************************************************/
-void Qt_Mutex::unlock()
+Mutex* Qt_Mutex_Factory::make()
{
- mutex->m.unlock();
+ return new Qt_Mutex();
}
}
+