aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread/PosixCond.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-09-24 21:49:20 +0200
committerMax Kellermann <max@duempel.org>2014-09-24 21:49:20 +0200
commit92704857231423f662152495d5521301195dfd17 (patch)
treefdc2e8102018456790652f3c96953ce23147ce56 /src/thread/PosixCond.hxx
parentcbdaf4827fedd4159de07a648899d88ca9a884af (diff)
parente93975cb466db335f4c9739669fb22ad4ecf0b08 (diff)
downloadmpd-92704857231423f662152495d5521301195dfd17.tar.gz
mpd-92704857231423f662152495d5521301195dfd17.tar.xz
mpd-92704857231423f662152495d5521301195dfd17.zip
Merge branch 'v0.18.x'
Diffstat (limited to 'src/thread/PosixCond.hxx')
-rw-r--r--src/thread/PosixCond.hxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx
index e0d6623dd..b3fe204e1 100644
--- a/src/thread/PosixCond.hxx
+++ b/src/thread/PosixCond.hxx
@@ -41,10 +41,21 @@ class PosixCond {
pthread_cond_t cond;
public:
-#ifndef __BIONIC__
- constexpr
+#if defined(__NetBSD__) || defined(__BIONIC__)
+ /* NetBSD's PTHREAD_COND_INITIALIZER is not compatible with
+ "constexpr" */
+ PosixCond() {
+ pthread_cond_init(&cond, nullptr);
+ }
+
+ ~PosixCond() {
+ pthread_cond_destroy(&cond);
+ }
+#else
+ /* optimized constexpr constructor for sane POSIX
+ implementations */
+ constexpr PosixCond():cond(PTHREAD_COND_INITIALIZER) {}
#endif
- PosixCond():cond(PTHREAD_COND_INITIALIZER) {}
PosixCond(const PosixCond &other) = delete;
PosixCond &operator=(const PosixCond &other) = delete;