aboutsummaryrefslogtreecommitdiffstats
path: root/src/mutex/qt_mutex
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-28 19:29:24 +0000
committerlloyd <[email protected]>2008-09-28 19:29:24 +0000
commit9bcfe627321ddc81691b835dffaa6324ac4684a4 (patch)
treefe5e8ae9813b853549558b59833022e87e83981b /src/mutex/qt_mutex
parent9822a701516396b7de4e41339faecd48ff8dc8ff (diff)
Move all modules into src/ directory
Diffstat (limited to 'src/mutex/qt_mutex')
-rw-r--r--src/mutex/qt_mutex/modinfo.txt18
-rw-r--r--src/mutex/qt_mutex/mux_qt.cpp33
-rw-r--r--src/mutex/qt_mutex/mux_qt.h25
3 files changed, 76 insertions, 0 deletions
diff --git a/src/mutex/qt_mutex/modinfo.txt b/src/mutex/qt_mutex/modinfo.txt
new file mode 100644
index 000000000..a21108c79
--- /dev/null
+++ b/src/mutex/qt_mutex/modinfo.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
+
+<add>
+mux_qt.cpp
+mux_qt.h
+</add>
+
+# I think we want to always use qt-mt, not qt -- not much point in supporting
+# mutexes in a single threaded application, after all.
+<libs>
+all -> qt-mt
+</libs>
diff --git a/src/mutex/qt_mutex/mux_qt.cpp b/src/mutex/qt_mutex/mux_qt.cpp
new file mode 100644
index 000000000..421b771c7
--- /dev/null
+++ b/src/mutex/qt_mutex/mux_qt.cpp
@@ -0,0 +1,33 @@
+/*************************************************
+* Qt Thread Mutex Source File *
+* (C) 2004-2007 Justin Karneges *
+* 2004-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/mux_qt.h>
+#include <qmutex.h>
+
+#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..fffdc78ae
--- /dev/null
+++ b/src/mutex/qt_mutex/mux_qt.h
@@ -0,0 +1,25 @@
+/*************************************************
+* Qt Mutex Header File *
+* (C) 2004-2007 Justin Karneges *
+* 2004-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_MUTEX_QT_H__
+#define BOTAN_MUTEX_QT_H__
+
+#include <botan/mutex.h>
+
+namespace Botan {
+
+/*************************************************
+* Qt Mutex *
+*************************************************/
+class Qt_Mutex_Factory : public Mutex_Factory
+ {
+ public:
+ Mutex* make();
+ };
+
+}
+
+#endif