diff options
Diffstat (limited to 'modules/mux_qt/mux_qt.cpp')
-rw-r--r-- | modules/mux_qt/mux_qt.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/mux_qt/mux_qt.cpp b/modules/mux_qt/mux_qt.cpp new file mode 100644 index 000000000..0d419d38a --- /dev/null +++ b/modules/mux_qt/mux_qt.cpp @@ -0,0 +1,56 @@ +/************************************************* +* Qt Thread Mutex Source File * +* (C) 1999-2006 The Botan Project * +*************************************************/ + +#include <botan/mux_qt.h> +#include <botan/exceptn.h> +#include <qmutex.h> + +#if !defined(QT_THREAD_SUPPORT) + #error Your version of Qt does not support threads or mutexes +#endif + +namespace Botan { + +/************************************************* +* Wrapper Type for Qt Thread Mutex * +*************************************************/ +struct mutex_wrapper + { + QMutex m; + }; + +/************************************************* +* Constructor * +*************************************************/ +Qt_Mutex::Qt_Mutex() + { + mutex = new mutex_wrapper; + } + +/************************************************* +* Destructor * +*************************************************/ +Qt_Mutex::~Qt_Mutex() + { + delete mutex; + } + +/************************************************* +* Lock the Mutex * +*************************************************/ +void Qt_Mutex::lock() + { + mutex->m.lock(); + } + +/************************************************* +* Unlock the Mutex * +*************************************************/ +void Qt_Mutex::unlock() + { + mutex->m.unlock(); + } + +} |