Merge change 24335 into eclair
* changes: use broadcast() instead of signal() when signaling the condition-variable Thread::RequestExitAndWait() is waiting for
This commit is contained in:
@@ -408,6 +408,9 @@ private:
|
|||||||
volatile bool mExitPending;
|
volatile bool mExitPending;
|
||||||
volatile bool mRunning;
|
volatile bool mRunning;
|
||||||
sp<Thread> mHoldSelf;
|
sp<Thread> mHoldSelf;
|
||||||
|
#if HAVE_ANDROID_OS
|
||||||
|
int mTid;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -655,6 +655,11 @@ int Thread::_threadLoop(void* user)
|
|||||||
wp<Thread> weak(strong);
|
wp<Thread> weak(strong);
|
||||||
self->mHoldSelf.clear();
|
self->mHoldSelf.clear();
|
||||||
|
|
||||||
|
#if HAVE_ANDROID_OS
|
||||||
|
// this is very useful for debugging with gdb
|
||||||
|
self->mTid = gettid();
|
||||||
|
#endif
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -685,7 +690,7 @@ int Thread::_threadLoop(void* user)
|
|||||||
self->mExitPending = true;
|
self->mExitPending = true;
|
||||||
self->mLock.lock();
|
self->mLock.lock();
|
||||||
self->mRunning = false;
|
self->mRunning = false;
|
||||||
self->mThreadExitedCondition.signal();
|
self->mThreadExitedCondition.broadcast();
|
||||||
self->mLock.unlock();
|
self->mLock.unlock();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -693,7 +698,7 @@ int Thread::_threadLoop(void* user)
|
|||||||
// Release our strong reference, to let a chance to the thread
|
// Release our strong reference, to let a chance to the thread
|
||||||
// to die a peaceful death.
|
// to die a peaceful death.
|
||||||
strong.clear();
|
strong.clear();
|
||||||
// And immediately, reacquire a strong reference for the next loop
|
// And immediately, re-acquire a strong reference for the next loop
|
||||||
strong = weak.promote();
|
strong = weak.promote();
|
||||||
} while(strong != 0);
|
} while(strong != 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user