diff options
Diffstat (limited to '')
-rw-r--r-- | src/thread/PosixCond.hxx | 17 |
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; |