Merge branch 'v0.18.x'

This commit is contained in:
Max Kellermann
2014-09-24 21:49:20 +02:00
7 changed files with 48 additions and 8 deletions

View File

@@ -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;