[En-Nut-Discussion] Fwd: NutEventWait & dummy queues

Harald Kipp harald.kipp at egnite.de
Tue Nov 11 19:29:47 CET 2003


>Delivered-To: web2p2 at p15095813.pureserver.info
>Date: Wed, 29 Oct 2003 10:51:08 -0800 (PST)
>From: JasonG <jas_g at yahoo.com>
>Subject: NutEventWait & dummy queues
>To: en-nut-discussion at egnite.de
>
>
>Up until now I have been, instead of using the NutSleep(), relying on
>waiting on a event to a dummy queue and just setting a timeout.
>Nothing ever posts a message to this dummy queue, so the timeout will
>allow for execution to resume.
>
>NutEventWait(&Q_dummy_msg, 63 + 1)
>
>Now I am wondering what happens when multiple threads may have been
>waiting on this same queue with a timeout value.  What is the behavior
>when for example Thread1 has issued this for say 5sec, Thread2 starts
>at 4.95 sec, executes for 1 sec, and now issues this wait for 0.5 sec.
>Will Thread1 somehow be resumed first?  Imagine they are of the same
>priority.
>
>I am experiencing some lockup issues and it would appear that I'm not
>NutThreadYield() 'ing enough at certain times.  For instance, I run
>some comms activity in a thread context for more than 10 seconds (in a
>structure similar to the httpd example with the web server running) and
>am preempted by some other thread while doing this.  This ends up
>leading to lockups at times for unknown reasons.. but I think I need to
>rethink both the NutThreadYield() and NutEventWait() strategy that I
>mentioned above.
>
>How do we know when we should be NutThreadYield()'ing when we're in the
>middle of an operation that doesn't want to be interrupted?  What might
>have forced my preemption here?  I am not waiting on any other obvious
>resources, unless there is some system issue that implicitly implies
>this (ie. the dummy message waiting scenario).  Nothing else has a
>higher priority (a lower number) than this long running thread.
>
>I thought that the run-to-completion semantics would suggest that this
>is just something that can't occur?
>
>Thanks for any ideas,
>
>
>
>=====
>JasonG
>jas_g at yahoo.com




More information about the En-Nut-Discussion mailing list