mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-07-28 13:47:55 +00:00
nimble/ll: Fix removing elements from the scheduler
This patch makes sure to start scheduler timer only for valid entry. Also now function will return imidiatelly if scheduler list is empty.
This commit is contained in:
@@ -1112,6 +1112,11 @@ ble_ll_sched_rmv_elem_type(uint8_t type, sched_remove_cb_func remove_cb)
|
||||
OS_ENTER_CRITICAL(sr);
|
||||
first = TAILQ_FIRST(&g_ble_ll_sched_q);
|
||||
|
||||
if (!first) {
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
return;
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(entry, &g_ble_ll_sched_q, link) {
|
||||
if (entry->sched_type == type) {
|
||||
if (first == entry) {
|
||||
@@ -1127,7 +1132,9 @@ ble_ll_sched_rmv_elem_type(uint8_t type, sched_remove_cb_func remove_cb)
|
||||
|
||||
if (!first) {
|
||||
first = TAILQ_FIRST(&g_ble_ll_sched_q);
|
||||
os_cputime_timer_start(&g_ble_ll_sched_timer, first->start_time);
|
||||
if (first) {
|
||||
os_cputime_timer_start(&g_ble_ll_sched_timer, first->start_time);
|
||||
}
|
||||
}
|
||||
|
||||
OS_EXIT_CRITICAL(sr);
|
||||
|
||||
Reference in New Issue
Block a user