summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-01-03 12:48:29 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-03-11 09:16:34 +0700
commit97375f4576ee0637d4a3452a411900f224beeb44 (patch)
tree2cc7ad5f930b96942a7b24368092b308b7fc0d4e /esp8266
parent7261f17b9ec21be706e5b8cb1173b46ed0985cc3 (diff)
downloadmicropython-97375f4576ee0637d4a3452a411900f224beeb44.tar.gz
micropython-97375f4576ee0637d4a3452a411900f224beeb44.zip
esp8266/ets_alt_task: Be sure to "pop" event before calling its handler.
Otherwise, if handler calls recursive event loop, there's infinite recursion (because the loop calls the same handler on same event again).
Diffstat (limited to 'esp8266')
-rw-r--r--esp8266/ets_alt_task.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/esp8266/ets_alt_task.c b/esp8266/ets_alt_task.c
index ece7727f0b..d408175ddc 100644
--- a/esp8266/ets_alt_task.c
+++ b/esp8266/ets_alt_task.c
@@ -111,16 +111,17 @@ bool ets_loop_iter(void) {
progress = true;
//printf("#%d Calling task %d(%p) (%x, %x)\n", cnt++,
// t - emu_tasks + FIRST_PRIO, t->task, t->queue[t->i_get].sig, t->queue[t->i_get].par);
- //ets_intr_unlock();
- t->task(&t->queue[t->i_get]);
- //ets_intr_lock();
- //printf("Done calling task %d\n", t - emu_tasks + FIRST_PRIO);
+ int idx = t->i_get;
if (t->i_put == -1) {
t->i_put = t->i_get;
}
if (++t->i_get == t->qlen) {
t->i_get = 0;
}
+ //ets_intr_unlock();
+ t->task(&t->queue[idx]);
+ //ets_intr_lock();
+ //printf("Done calling task %d\n", t - emu_tasks + FIRST_PRIO);
}
ets_intr_unlock();
}