From: Philippe Gerum <rpm@xenomai.org>
To: ROSSIER Daniel <Daniel.Rossier@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Event flag anomaly
Date: Tue, 31 Jan 2006 14:26:31 +0100 [thread overview]
Message-ID: <43DF6587.2070207@domain.hid> (raw)
In-Reply-To: <FDBBB5CC70676540B3EF7CFE83FD94E00430B4@domain.hid>
ROSSIER Daniel wrote:
>
> Hi,
>
> I've some problems to understand how the event flag semantic is defined.
>
> In the example below, I just defined a RT_EVENT task which waits on event mask 1.
> (Simply bit 1 has to be set).
> When I do a rt_event_signal(&meteoEvents, 1) from another task, the blocking task
> is logically waked up. Fine. On the next iteration, the event bit set is remaining
> unchanged and the rt_event_wait() doesn't wait anymore since the event is activated.
> (please consider the rt_event_clear as commented lines as it is). Well, it seems
> OK. BUT, on the third iteration, the rt_event_wait() is blocking! Actually, the bit
> set has been cleared in the meanwhile.
>
> Looking at the rt_event_wait() code in native/event.c, it effectively turns out that
> the bit set is cleared according to the mask, if and only if the task doesn't need to wait.
>
> Please could you explain me what's the rationale behind this strange behaviour? I would propose that the bits
> remain unchanged until a clear(). (I probably missed something in my reasoning).
You are right. Auto-clearing the satisfied event bits is spurious here. Fixed, thanks.
>
> Here is the example:
> ---------------------------
>
> void meteoDataAcquisition(void *cookie) {
>
> unsigned long receivedMask;
>
> while(1) {
>
> rt_event_wait(&meteoEvents, 1, &receivedMask, EV_ANY, TM_INFINITE);
> //rt_event_clear(&meteoEvents, 1, &receivedMask);
>
>
> printk("#Task activated\n");
>
> }
>
> }
> -------------------------------
>
> And a piece of code from event.c
>
> ....
> if (((mode & EV_ANY) && (mask & event->value) != 0) ||
> (!(mode & EV_ANY) && ((mask & event->value) == mask)))
> {
> *mask_r = (event->value & mask);
> event->value &= ~mask; --> this is not done after the thread has been waked up.
> goto unlock_and_exit;
> }
> .....
>
>
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
>
--
Philippe.
prev parent reply other threads:[~2006-01-31 13:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-31 12:28 [Xenomai-help] Event flag anomaly ROSSIER Daniel
2006-01-31 13:26 ` Philippe Gerum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43DF6587.2070207@domain.hid \
--to=rpm@xenomai.org \
--cc=Daniel.Rossier@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.