Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5995ea50 authored by Zhihai Xu's avatar Zhihai Xu
Browse files

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
parent a451e1c6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -197,12 +197,12 @@ void bte_main_enable()

    lpm_enabled = FALSE;

    bte_hci_enable();

    GKI_create_task((TASKPTR)btu_task, BTU_TASK, BTE_BTU_TASK_STR,
                    (UINT16 *) ((UINT8 *)bte_btu_stack + BTE_BTU_STACK_SIZE),
                    sizeof(bte_btu_stack));

    bte_hci_enable();

    GKI_run(0);
}