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).
This commit is contained in:
Paul Sokolovsky 2016-01-03 12:48:29 +02:00
parent 7261f17b9e
commit 97375f4576

View File

@ -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();
}