aboutsummaryrefslogtreecommitdiffstats
path: root/src/thread/PosixCond.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/PosixCond.hxx')
-rw-r--r--src/thread/PosixCond.hxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/thread/PosixCond.hxx b/src/thread/PosixCond.hxx
index 6f98d3ad0..c2797649a 100644
--- a/src/thread/PosixCond.hxx
+++ b/src/thread/PosixCond.hxx
@@ -41,7 +41,21 @@ class PosixCond {
pthread_cond_t cond;
public:
+#ifdef __NetBSD__
+ /* 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(const PosixCond &other) = delete;
PosixCond &operator=(const PosixCond &other) = delete;