summaryrefslogtreecommitdiff
path: root/libs/qm-dsp/thread
diff options
context:
space:
mode:
Diffstat (limited to 'libs/qm-dsp/thread')
-rw-r--r--libs/qm-dsp/thread/AsynchronousTask.h2
-rw-r--r--libs/qm-dsp/thread/Thread.cpp22
-rw-r--r--libs/qm-dsp/thread/Thread.h5
3 files changed, 16 insertions, 13 deletions
diff --git a/libs/qm-dsp/thread/AsynchronousTask.h b/libs/qm-dsp/thread/AsynchronousTask.h
index b54184ae10..d9d7d872c9 100644
--- a/libs/qm-dsp/thread/AsynchronousTask.h
+++ b/libs/qm-dsp/thread/AsynchronousTask.h
@@ -77,7 +77,7 @@ protected:
}
virtual void performTask() = 0;
-
+
private:
virtual void run() {
m_todo.lock();
diff --git a/libs/qm-dsp/thread/Thread.cpp b/libs/qm-dsp/thread/Thread.cpp
index b2dd236051..85dcec3155 100644
--- a/libs/qm-dsp/thread/Thread.cpp
+++ b/libs/qm-dsp/thread/Thread.cpp
@@ -58,9 +58,9 @@ Thread::start()
#endif
m_extant = true;
}
-}
+}
-void
+void
Thread::wait()
{
if (m_extant) {
@@ -233,7 +233,7 @@ Condition::unlock()
ReleaseMutex(m_mutex);
}
-void
+void
Condition::wait(int us)
{
if (us == 0) {
@@ -248,7 +248,7 @@ Condition::wait(int us)
DWORD ms = us / 1000;
if (us > 0 && ms == 0) ms = 1;
-
+
#ifdef DEBUG_CONDITION
cerr << "CONDITION DEBUG: " << (void *)GetCurrentThreadId() << ": Timed waiting on " << &m_condition << " \"" << m_name << "\"" << endl;
#endif
@@ -310,9 +310,9 @@ Thread::start()
#endif
m_extant = true;
}
-}
+}
-void
+void
Thread::wait()
{
if (m_extant) {
@@ -490,7 +490,7 @@ Condition::unlock()
pthread_mutex_unlock(&m_mutex);
}
-void
+void
Condition::wait(int us)
{
if (us == 0) {
@@ -514,7 +514,7 @@ Condition::wait(int us)
struct timespec timeout;
timeout.tv_sec = now.tv_sec;
timeout.tv_nsec = now.tv_usec * 1000;
-
+
#ifdef DEBUG_CONDITION
cerr << "CONDITION DEBUG: " << (void *)pthread_self() << ": Timed waiting on " << &m_condition << " \"" << m_name << "\"" << endl;
#endif
@@ -551,9 +551,9 @@ void
Thread::start()
{
abort();
-}
+}
-void
+void
Thread::wait()
{
abort();
@@ -611,7 +611,7 @@ Condition::lock()
abort();
}
-void
+void
Condition::wait(int us)
{
abort();
diff --git a/libs/qm-dsp/thread/Thread.h b/libs/qm-dsp/thread/Thread.h
index e26f452430..cd5489d379 100644
--- a/libs/qm-dsp/thread/Thread.h
+++ b/libs/qm-dsp/thread/Thread.h
@@ -13,8 +13,11 @@
#ifdef _WIN32
#include <windows.h>
#else /* !_WIN32 */
+#define USE_PTHREADS
#ifdef USE_PTHREADS
#include <pthread.h>
+#else
+#error Must have either _WIN32 or USE_PTHREADS defined
#endif /* USE_PTHREADS */
#endif /* !_WIN32 */
@@ -127,7 +130,7 @@ public:
void wait(int us = 0);
void signal();
-
+
private:
#ifdef _WIN32