Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How does one wait on more than one object in VxWorks ?.

112 views
Skip to first unread message

rvsaripa

unread,
Dec 22, 1998, 3:00:00 AM12/22/98
to
Consider the following scenario .

I have 2 semaphores and file descriptor I need to wait on at the same time
in a certain task context that has access to them ).

Can I use select() ?. When I read the documentation on select, it seems to
take only file descriptors ( semaphores are not file descriptors, are they
? ) .

In short , I am looking for a mechanism such as WaitForMultipleObjects() on
Win32 ( NT / 95 / 98 ) .

Thanks for any help in advance,
rk

please e-mail me at ramakrishn...@intel.com

All opinions are mine and mine only .


Ephraim Ezekiel

unread,
Dec 23, 1998, 3:00:00 AM12/23/98
to
There is really no easy way to wait on multiple objects. That is why the select
is used in Unix and VxWorks. The select doesn't work for semaphores and queues.

One option is to create multiple tasks which each waits on the different types
of events and then have the 2 tasks coordinate their shared data.

One thing that I did is to use the signal to wait on multiple events although I
am not sure how a file descriptor can be mapped to a signal. Signals can either
be processed asynchronously by a signal handler or synchrounously in the task's
main thread.

The select really only works for sockets, pipes and asynchronous events that
use file descriptors.

Todd Litwin

unread,
Dec 23, 1998, 3:00:00 AM12/23/98
to
rvsaripa <ramakrishn...@intel.com> wrote:

>I have 2 semaphores and file descriptor I need to wait on at the same time
> in a certain task context that has access to them ).
>
>Can I use select() ?. When I read the documentation on select, it seems to
>take only file descriptors ( semaphores are not file descriptors, are they

Two mechanisms come to mind:

1. If you want to use select(), then try using pipes instead of semaphores.
Look at the documentation for pipeDevCreate(). This will create a device,
with a file descriptor usable in select(), that can be written to and read
from, and can be used similar to a semaphore if desired.

2. Or you could use a single message queue. Look at msgQLib. Your different
semaphores could be queued items with different (application-defined) ID
numbers.

--
Todd Litwin
Jet Propulsion Laboratory
(818) 354-5028
Todd.E...@jpl.nasa.gov

0 new messages