mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 10:30:58 +02:00
fix(wifi) : Made changes related to registering eloop timeout for eloop lock
This commit is contained in:
@@ -137,27 +137,23 @@ int eloop_register_timeout(unsigned int secs, unsigned int usecs,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Maintain timeouts in order of increasing time */
|
/* Maintain timeouts in order of increasing time */
|
||||||
|
ELOOP_LOCK();
|
||||||
dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
|
dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
|
||||||
if (os_reltime_before(&timeout->time, &tmp->time)) {
|
if (os_reltime_before(&timeout->time, &tmp->time)) {
|
||||||
ELOOP_LOCK();
|
|
||||||
dl_list_add(tmp->list.prev, &timeout->list);
|
dl_list_add(tmp->list.prev, &timeout->list);
|
||||||
ELOOP_UNLOCK();
|
|
||||||
goto run;
|
goto run;
|
||||||
}
|
}
|
||||||
#ifdef ELOOP_DEBUG
|
#ifdef ELOOP_DEBUG
|
||||||
count++;
|
count++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ELOOP_LOCK();
|
|
||||||
dl_list_add_tail(&eloop.timeout, &timeout->list);
|
dl_list_add_tail(&eloop.timeout, &timeout->list);
|
||||||
ELOOP_UNLOCK();
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
#ifdef ELOOP_DEBUG
|
#ifdef ELOOP_DEBUG
|
||||||
wpa_printf(MSG_DEBUG, "ELOOP: Added one timer from %s:%d to call %p, current order=%d",
|
wpa_printf(MSG_DEBUG, "ELOOP: Added one timer from %s:%d to call %p, current order=%d",
|
||||||
timeout->func_name, line, timeout->handler, count);
|
timeout->func_name, line, timeout->handler, count);
|
||||||
#endif
|
#endif
|
||||||
ELOOP_LOCK();
|
|
||||||
os_timer_disarm(&eloop.eloop_timer);
|
os_timer_disarm(&eloop.eloop_timer);
|
||||||
os_timer_arm(&eloop.eloop_timer, 0, 0);
|
os_timer_arm(&eloop.eloop_timer, 0, 0);
|
||||||
ELOOP_UNLOCK();
|
ELOOP_UNLOCK();
|
||||||
@@ -227,27 +223,23 @@ int eloop_register_timeout_blocking(eloop_blocking_timeout_handler handler,
|
|||||||
}
|
}
|
||||||
timeout->sync_semph = eloop.eloop_semph;
|
timeout->sync_semph = eloop.eloop_semph;
|
||||||
/* Maintain timeouts in order of increasing time */
|
/* Maintain timeouts in order of increasing time */
|
||||||
|
ELOOP_LOCK();
|
||||||
dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
|
dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
|
||||||
if (os_reltime_before(&timeout->time, &tmp->time)) {
|
if (os_reltime_before(&timeout->time, &tmp->time)) {
|
||||||
ELOOP_LOCK();
|
|
||||||
dl_list_add(tmp->list.prev, &timeout->list);
|
dl_list_add(tmp->list.prev, &timeout->list);
|
||||||
ELOOP_UNLOCK();
|
|
||||||
goto run;
|
goto run;
|
||||||
}
|
}
|
||||||
#ifdef ELOOP_DEBUG
|
#ifdef ELOOP_DEBUG
|
||||||
count++;
|
count++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ELOOP_LOCK();
|
|
||||||
dl_list_add_tail(&eloop.timeout, &timeout->list);
|
dl_list_add_tail(&eloop.timeout, &timeout->list);
|
||||||
ELOOP_UNLOCK();
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
#ifdef ELOOP_DEBUG
|
#ifdef ELOOP_DEBUG
|
||||||
wpa_printf(MSG_DEBUG, "ELOOP: Added one blocking timer from %s:%d to call %p, current order=%d",
|
wpa_printf(MSG_DEBUG, "ELOOP: Added one blocking timer from %s:%d to call %p, current order=%d",
|
||||||
timeout->func_name, line, timeout->handler, count);
|
timeout->func_name, line, timeout->handler, count);
|
||||||
#endif
|
#endif
|
||||||
ELOOP_LOCK();
|
|
||||||
os_timer_disarm(&eloop.eloop_timer);
|
os_timer_disarm(&eloop.eloop_timer);
|
||||||
os_timer_arm(&eloop.eloop_timer, 0, 0);
|
os_timer_arm(&eloop.eloop_timer, 0, 0);
|
||||||
ELOOP_UNLOCK();
|
ELOOP_UNLOCK();
|
||||||
@@ -447,8 +439,10 @@ void eloop_run(void)
|
|||||||
while (!dl_list_empty(&eloop.timeout)) {
|
while (!dl_list_empty(&eloop.timeout)) {
|
||||||
struct eloop_timeout *timeout;
|
struct eloop_timeout *timeout;
|
||||||
|
|
||||||
|
ELOOP_LOCK();
|
||||||
timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
|
timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
|
||||||
list);
|
list);
|
||||||
|
ELOOP_UNLOCK();
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
os_get_reltime(&now);
|
os_get_reltime(&now);
|
||||||
if (os_reltime_before(&now, &timeout->time)) {
|
if (os_reltime_before(&now, &timeout->time)) {
|
||||||
|
Reference in New Issue
Block a user