nimble: Use the stop event to validate instead of an argument

This commit is contained in:
Hrishikesh Dhayagude
2019-10-21 22:23:37 +05:30
parent acaed3b6a8
commit bb92592d81
2 changed files with 2 additions and 6 deletions
@@ -25,8 +25,6 @@
#define NIMBLE_CORE (CONFIG_BT_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BT_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY)
#define NIMBLE_STACK_SIZE CONFIG_BT_NIMBLE_TASK_STACK_SIZE
#define NIMBLE_PORT_DEINIT_EV_ARG -1
#ifdef __cplusplus
extern "C" {
#endif
+2 -4
View File
@@ -75,13 +75,11 @@ void
nimble_port_run(void)
{
struct ble_npl_event *ev;
int arg;
while (1) {
ev = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER);
ble_npl_event_run(ev);
arg = (int)ble_npl_event_get_arg(ev);
if (arg == NIMBLE_PORT_DEINIT_EV_ARG) {
if (ev == &ble_hs_ev_stop) {
break;
}
}
@@ -120,7 +118,7 @@ nimble_port_stop(void)
ble_npl_sem_pend(&ble_hs_stop_sem, BLE_NPL_TIME_FOREVER);
ble_npl_event_init(&ble_hs_ev_stop, nimble_port_stop_cb,
(void *)NIMBLE_PORT_DEINIT_EV_ARG);
NULL);
ble_npl_eventq_put(&g_eventq_dflt, &ble_hs_ev_stop);
/* Wait till the event is serviced */