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 .
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.
>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