Waiting for multiple events

Mogens Dybæk Christensen MogensD.Christensen at man.eu
Tue Nov 29 14:18:12 UTC 2011

Hi everyone

We are about to port code from the RTXC OS to RTEMS. Several modules use a pattern, where a task is waiting for one of several things to happen. Can be timer, semaphore(s) or queue. The current wrapper implementation uses a semaphore _list_ function in RTXC, which has no direct counterpart in RTEMS.

The wanted function is similar to select(). (WaitForMultipleObjects() on Windows is another example.) The FAQ on the wiki mentions  RTEMS event as a good alternative.

So, the solution could be, that a semaphore or queue is signalled, e.g. from interrupt, and a small helper task waiting at that semaphore/queue will translate to an RTEMS event for the appropriate task. Then the task will check the event mask to see who called, and read from the  queue if needed.

Has anyone done something similar? I am not really happy with the extra helper tasks.  :)

But they may be necessary if there is no simple way for the interrupt handler to know the receiving task and its local event encoding.

Mogens Dybæk Christensen
Software Engineer
LDE5, Electronics & Software, Basic Software Platform
MogensD.Christensen at man.eu<mailto:MogensD.Christensen at man.eu>, +45 3385 2362
MAN Diesel & Turbo SE, Copenhagen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20111129/8c5563d9/attachment.html>

More information about the users mailing list