block on sem and SIGEV_INTR?

Hi,

Is there a select() or dispatch-type function to have a process block
until either a semaphore becomes available or a SIGEV_INTR event
is received? I was hoping that sem_wait() would unblock when a
SIGEV_INTR came by, but that didn’t seem to be the case in the test
code I whipped up.

BTW, what is a SIGEV_INTR anyways? Is it a signal…a message…
something else?

Thanks,

Arthur

Arthur Q <3_arthur@my-deja.com> wrote:

Is there a select() or dispatch-type function to have a process block
until either a semaphore becomes available or a SIGEV_INTR event
is received? I was hoping that sem_wait() would unblock when a
SIGEV_INTR came by, but that didn’t seem to be the case in the test
code I whipped up.

BTW, what is a SIGEV_INTR anyways? Is it a signal…a message…
something else?

I think you’d want to send a signal - that’ll cause the sem_wait() to
come back (you’ll have to have some sort of signal handler so that
the process doesn’t die). The SIGEV_INTR is used with interrupt handlers.
It causes a thread blocked in the InterruptWait() function to return. The
SIGEV_INTR event is delived by either an InterruptAttachEvent(), or by the
return value of the interrupt handler function established by
InterruptAttatch().

Note that the thread that does the InterruptWait() has to be the same one
that did the InterruptAttach[Event].


Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

“Brian Stecher” <bstecher@qnx.com> wrote in message
news:8sn5s2$18h$1@nntp.qnx.com

Arthur Q <> 3_arthur@my-deja.com> > wrote:
Is there a select() or dispatch-type function to have a process block
until either a semaphore becomes available or a SIGEV_INTR event
is received? I was hoping that sem_wait() would unblock when a
SIGEV_INTR came by, but that didn’t seem to be the case in the test
code I whipped up.

BTW, what is a SIGEV_INTR anyways? Is it a signal…a message…
something else?

I think you’d want to send a signal - that’ll cause the sem_wait() to
come back (you’ll have to have some sort of signal handler so that
the process doesn’t die). The SIGEV_INTR is used with interrupt handlers.
It causes a thread blocked in the InterruptWait() function to return. The
SIGEV_INTR event is delived by either an InterruptAttachEvent(), or by the
return value of the interrupt handler function established by
InterruptAttatch().

This IS for an interrupt handler, inside a resource manager doing some
high-frequency i/o stuff. I just wanted to see if there was a function to do
this kind of blocking. Is the answer no? I guess I can switch to using
pulses or something if that’s the case.

Thanks,

Arthur

Arthur Q <3_arthur@my-deja.com> wrote:

This IS for an interrupt handler, inside a resource manager doing some
high-frequency i/o stuff. I just wanted to see if there was a function to do
this kind of blocking. Is the answer no?

Yup.

I guess I can switch to using pulses or something if that’s the case.

With RM’s, the canonical method is to use a pulse. Alternatively, you
can have a seperate thread that just does InterruptWait()'s.

\

Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8