summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-12-29 11:40:00 +0100
committerMax Kellermann <max@musicpd.org>2017-01-03 07:07:10 +0100
commita42021655c3218c64272b648438197247ec7f6a9 (patch)
treef7845d20fe8834545f9449941942b60058dacbbe /src
parent2498a2b0bd43a0db901837131410efef5a6c1885 (diff)
thread/Cond: make the integer-based timed_wait() overload private
Make sure this deprecated API is not used.
Diffstat (limited to 'src')
-rw-r--r--src/thread/PosixCond.hxx2
-rw-r--r--src/thread/WindowsCond.hxx2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx
index 2428aa5c7..208ba1ed5 100644
--- a/src/thread/PosixCond.hxx
+++ b/src/thread/PosixCond.hxx
@@ -74,6 +74,7 @@ public:
pthread_cond_wait(&cond, &mutex.mutex);
}
+private:
bool timed_wait(PosixMutex &mutex, unsigned timeout_ms) {
struct timeval now;
gettimeofday(&now, nullptr);
@@ -90,6 +91,7 @@ public:
return pthread_cond_timedwait(&cond, &mutex.mutex, &ts) == 0;
}
+public:
bool timed_wait(PosixMutex &mutex,
std::chrono::steady_clock::duration timeout) {
auto timeout_ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count();
diff --git a/src/thread/WindowsCond.hxx b/src/thread/WindowsCond.hxx
index 0419ee3c3..04620dbaf 100644
--- a/src/thread/WindowsCond.hxx
+++ b/src/thread/WindowsCond.hxx
@@ -56,11 +56,13 @@ public:
WakeAllConditionVariable(&cond);
}
+private:
bool timed_wait(CriticalSection &mutex, DWORD timeout_ms) {
return SleepConditionVariableCS(&cond, &mutex.critical_section,
timeout_ms);
}
+public:
bool timed_wait(CriticalSection &mutex,
std::chrono::steady_clock::duration timeout) {
auto timeout_ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count();