summaryrefslogtreecommitdiffstats
path: root/libs/utils
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utils')
-rw-r--r--libs/utils/Threads.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index 15bb1d2..48ce5d1 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -842,6 +842,25 @@ status_t Thread::requestExitAndWait()
return mStatus;
}
+status_t Thread::join()
+{
+ Mutex::Autolock _l(mLock);
+ if (mThread == getThreadId()) {
+ LOGW(
+ "Thread (this=%p): don't call join() from this "
+ "Thread object's thread. It's a guaranteed deadlock!",
+ this);
+
+ return WOULD_BLOCK;
+ }
+
+ while (mRunning == true) {
+ mThreadExitedCondition.wait(mLock);
+ }
+
+ return mStatus;
+}
+
bool Thread::exitPending() const
{
Mutex::Autolock _l(mLock);