From 5c6bb69607386a0b0be4e458a5b70b736cc9ee05 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sun, 3 Jan 2016 20:46:21 -0500 Subject: [PATCH] play-audio: Fix 64-bit build PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER should only be used for statically allocated mutexes - not doing it here breaks building on 64-bit Android. --- packages/play-audio/play-audio.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/play-audio/play-audio.cpp b/packages/play-audio/play-audio.cpp index 2d20b43b3..38f092e92 100644 --- a/packages/play-audio/play-audio.cpp +++ b/packages/play-audio/play-audio.cpp @@ -32,7 +32,11 @@ class AudioPlayer { class MutexWithCondition { public: - MutexWithCondition() { pthread_mutex_lock(&mutex); } + MutexWithCondition() { + pthread_mutex_init(&mutex, NULL); + pthread_cond_init(&condition, NULL); + pthread_mutex_lock(&mutex); + } ~MutexWithCondition() { pthread_mutex_unlock(&mutex); } void waitFor() { while (!occurred) pthread_cond_wait(&condition, &mutex); } /** From waking thread. */ @@ -44,8 +48,8 @@ class MutexWithCondition { } private: volatile bool occurred{false}; - pthread_mutex_t mutex{PTHREAD_MUTEX_INITIALIZER}; - pthread_cond_t condition{PTHREAD_COND_INITIALIZER}; + pthread_mutex_t mutex; + pthread_cond_t condition; }; AudioPlayer::AudioPlayer() {