[En-Nut-Discussion] NutThreadRemoveQueue clears runQueue to NULL

Philipp Burch phip at hb9etc.ch
Mon Aug 26 11:53:06 CEST 2013


Hi all,

ok, I suppose this is solved now. After some more poking around, I've 
found the timers demo application of Nut/OS (nutapp/timers/timers.c) 
with the following comment above the timer callback function:

/*
  * Timer callback function.
  *
  * Timer callbacks are called during context switch processing. They must
  * return as soon as possible and must not call any potentially blocking
  * function.
  *
  * It would be great to be able to start a thread here, but unfortunately
  * this doesn't work in Nut/OS. :-(
  */

So my explanation for the problem is as follows:

The timer callback was fired regularly and wrote some output to the 
serial line. The serial buffer was usually empty, however, so the 
function did not need to block. With the network request, some text was 
printed and not yet flushed before the timer callback was fired, so the 
printing function blocked and caused the crash. A simple call to 
NutSleep() in the callback (even in the demo application) shows exactly 
the same behaviour on /every/ call, so this failure seems to be reliable.

So I'll remove the text output from the callback and leave it run for 
some time under different conditions, let's see if it works now.
But a note should probably be added to the timer documentation (or did I 
miss something there?).

Regards,
Philipp


More information about the En-Nut-Discussion mailing list