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

This commit is contained in:
Hrishikesh Dhayagude
2024-02-14 14:50:14 +05:30
committed by Abhinav Kudnar
parent ca983d2798
commit 8f8927d94a
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
@@ -77,13 +77,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;
}
}
@@ -122,7 +120,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 */