Fix issue 3302649.

The cause of the problem is that AudioTrack::start() can fail if it is called from a newly created
thread that has the same ID as the AudioTrack callback thread that has just been stopped and not yet exited.
This is possible as the thread ID used by the Thread class is not the TID.

The fix consists in clearing the thread ID before exiting the thread loop.

Change-Id: I8b5f6a63feeaeb9a01267380e85f6f1456e7aa01
This commit is contained in:
Eric Laurent 2011-01-04 11:58:04 -08:00
parent 559acb0c46
commit 15025254eb
1 changed files with 3 additions and 0 deletions

View File

@ -774,6 +774,9 @@ int Thread::_threadLoop(void* user)
self->mExitPending = true;
self->mLock.lock();
self->mRunning = false;
// clear thread ID so that requestExitAndWait() does not exit if
// called by a new thread using the same thread ID as this one.
self->mThread = thread_id_t(-1);
self->mThreadExitedCondition.broadcast();
self->mLock.unlock();
break;