[En-Nut-Discussion] Event API

Matthias Ringwald mringwal at inf.ethz.ch
Wed Oct 27 09:45:04 CEST 2004


On 26.10.2004, at 19:58, Henk Kampman wrote:

> Why is there no NutEventClear?

Because it's not (really) needed.

NutEventClear is identical to the also non-existant NutEventInit
which is realized by setting the event queue to 0:
theEvent = 0

hm. if your event might be posted from interrupt context, a critical 
section would come in handy.

NutEventInit/Reset/Clear:

NutEnterCritical()
theEvent = 0
NutExitCritical()


I was wondering how to initialize an event queue before, so
if someone would go forward and add this one line function (e.g. as an 
inline function :)
I would support it.

Matthias

>
> There are situations where another thread can complete and call 
> NutEventPost before you can call NutEventWaitNext.
>
> The result is that NutEventWaitNext wil wait forever, because it wil 
> clear the already signaled event!
>
> What you really need is something like this:
>
> {
> NutEventClear(&theEvent);
> ..




More information about the En-Nut-Discussion mailing list