[En-Nut-Discussion] NutSleep(0) doesn't yield

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Fri Sep 8 13:31:11 CEST 2006

>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:

    Harald> At 17:21 05.09.2006 +0200, you wrote:
    >> Simpy call the specific function: NutThreadYield()
    >> ----- Original Message ----- From: "Uwe Bonnes"
    >> <bon at elektron.ikp.physik.tu-darmstadt.de>
    >>> Thread t1 is never called, changing to NutSleep(1), the thread is
    >>> called. I thought, that even NutSleep(0) is a scheduling point.
    >>> How else can I yield in main() with minimal impact.

    Harald> By design, NutSleep(0) should be the same as NutThreadYield().

    Harald> Uwe, did you change priorities? When a thread calls NutSleep(0),
    Harald> it should give up the CPU, if there is another thread ready to
    Harald> run at the _same_ or higher priority,


I had NutThreadSetPriority(128) in the thread and NutSleep(0) in the main
programm. That way, the thread was never called. Only with NutSleep(1) in
the main programm the thread was called.

Removing the line "NutThreadSetPriority(128)" made the programm working as
expected, even with NutSleep(0) in the main program.

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

More information about the En-Nut-Discussion mailing list