diff options
Diffstat (limited to 'modules/mux_qt/mux_qt.cpp')
-rw-r--r-- | modules/mux_qt/mux_qt.cpp | 44 |
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(); } } + |