OSDN Git Service

bluez a2dp - fix wait_for_start() synchronization
authorIan Kent <raven@themaw.net>
Mon, 28 Sep 2009 15:47:44 +0000 (23:47 +0800)
committerNick Pelly <npelly@google.com>
Wed, 30 Sep 2009 00:11:37 +0000 (17:11 -0700)
commite496ac2823ad1a01ee19976df03dec913888e176
treee4fda66da846f61f9b118ffd1e86f4e550db7892
parent5053b04fd2a49c2a2f95efd83445b7d2be42ef6d
bluez a2dp - fix wait_for_start() synchronization

On entry to wait_for_start() it's possible we are in state
A2DP_STATE_NONE if a2dp_thread() has not completed bluetooth_init().
Also, we call the pthread_mutex_*() functions more frequently than
we really need to.

Move the mutex locking outside the loop and let condition wait
take care of the locking. Also move the A2DP_STATE_NONE check
below the condition wait so we can be sure the state machine
has been poked before we test it.

Change-Id: I020bea365a623e88cb1a5f7e5fccd8f8aa948518
audio/liba2dp.c