OSDN Git Service

a race condition which can cause potential BT preload timeout.
authorZhihai Xu <zhihaixu@google.com>
Wed, 15 Jan 2014 18:28:55 +0000 (10:28 -0800)
committerZhihai Xu <zhihaixu@google.com>
Wed, 15 Jan 2014 18:28:55 +0000 (10:28 -0800)
commit1a558ca6e9e89acbfbcc8ce9889efa96309dfd2e
treef3668cf087abd761a03f29967ad76dca7ae06b6d
parent6a5cd52ec261ba9212a969785467993e343b39b9
a race condition which can cause potential BT preload timeout.

a race condition which can cause potential BT preload timeout,
When BT startup, bt_hc_worker thread will send BT_EVT_PRELOAD_CMPL
to btu_task. However in bte_main_enable, it first calls
bte_hci_enable(), then creates btu_task. So it may send BT_EVT_PRELOAD_CMPL
before btu_task created. Change creating btu_task before call bte_hci_enable
to make sure btu_task already created successfully before send
BT_EVT_PRELOAD_CMPL.
If this race condition happen, the bluetooth will not be turned on.

bug:12566357
Change-Id: I245d2df90da0f9da324fc31e371dde8539c0926c
main/bte_main.c