aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/pthread
diff options
context:
space:
mode:
Diffstat (limited to 'src/jthread/pthread')
-rw-r--r--src/jthread/pthread/jsemaphore.cpp8
-rw-r--r--src/jthread/pthread/jthread.cpp4
2 files changed, 12 insertions, 0 deletions
diff --git a/src/jthread/pthread/jsemaphore.cpp b/src/jthread/pthread/jsemaphore.cpp
index f6d7f022f..609e2f518 100644
--- a/src/jthread/pthread/jsemaphore.cpp
+++ b/src/jthread/pthread/jsemaphore.cpp
@@ -51,7 +51,15 @@ JSemaphore::JSemaphore() {
JSemaphore::~JSemaphore() {
int sem_destroy_retval = sem_destroy(&m_semaphore);
+#ifdef __ANDROID__
+// WORKAROUND for broken bionic semaphore implementation!
+ assert(
+ (sem_destroy_retval == 0) ||
+ (errno == EBUSY)
+ );
+#else
assert(sem_destroy_retval == 0);
+#endif
UNUSED(sem_destroy_retval);
}
diff --git a/src/jthread/pthread/jthread.cpp b/src/jthread/pthread/jthread.cpp
index a8e54e315..e90c03456 100644
--- a/src/jthread/pthread/jthread.cpp
+++ b/src/jthread/pthread/jthread.cpp
@@ -111,7 +111,11 @@ int JThread::Kill()
}
return ERR_JTHREAD_NOTRUNNING;
}
+#ifdef __ANDROID__
+ pthread_kill(threadid, SIGKILL);
+#else
pthread_cancel(threadid);
+#endif
if (started) {
int pthread_join_retval = pthread_join(threadid,&status);
assert(pthread_join_retval == 0);