MsgReceive from message or pulse?

We’re migrating from 4.25 some applications that Receive either proxies
(timer proxy, trigger from another app, or from qnx_hint_attach) or messages
(from other processes). I can’t seem to find a way for MsgReceive to accept
from both.



I did find a good thread that explains pulses from interrupts like
qnx_hint_attach
(http://groups.google.com/groups?q=qnx+irq+10&hl=en&lr=&ie=UTF-8&oe=UTF-8&se
lm=fae6e8db.0207191254.63011a59%40posting.google.com&rnum=1 is the start of
it).



And after trial and error I got message passing to work (use name_open() for
local, _connect() for remote node()). So I thought I would just merge the
two - simple, huh.



Well, the first parameter of MsgReceive is the channel id. For pulses that
comes from a channel (PulseChID):



// tell the OS to send a pulse upon interrupt

PulseChID = ChannelCreate(_NTO_CHF_UNBLOCK);

PulseCoID = ConnectAttach(0, 0, PulseChID, _NTO_SIDE_CHANNEL,0);

SIGEV_PULSE_INIT(&PulseEvent, PulseCoID,SIGEV_PULSE_PRIO_INHERIT,

PULSE_CODE, NULL);

PulseIntID = InterruptAttachEvent(TIME_IRQ,
&PulseEvent,_NTO_INTR_FLAGS_TRK_MSK);



For messages it comes from the name_open or _connect.



These each work but separately. The MsgReceive seems to say “only accept
from this channel”. I would like to be able to hang one MsgReceive to be
triggered on pulses (from interrupts in this case) or messages from another
process like QNX4 had it. Is there a “accept from anyone” flag?



I found on this newsgroup something about _select_receive() but I’m not sure
what that’s all about.



Any suggestions?

Yeah, MsgReceive() only receives on one channel. It is designed that way, so
you can have
more channel in a process (and have more thread blocked on these channel).

In your case, you probably want to make your pulse comming into the same
channel.

pulseCode = ConnectAttach(0, 0, <channel_come_back_from_name_open>, …);

That should do it.

-xtang

Ken Price <kprice@harscotrack.com> wrote in message
news:bcqi87$mpm$1@inn.qnx.com

We’re migrating from 4.25 some applications that Receive either proxies
(timer proxy, trigger from another app, or from qnx_hint_attach) or
messages
(from other processes). I can’t seem to find a way for MsgReceive to
accept
from both.



I did find a good thread that explains pulses from interrupts like
qnx_hint_attach

(> http://groups.google.com/groups?q=qnx+irq+10&hl=en&lr=&ie=UTF-8&oe=UTF-8&se
lm=fae6e8db.0207191254.63011a59%40posting.google.com&rnum=1 is the start
of
it).



And after trial and error I got message passing to work (use name_open()
for
local, _connect() for remote node()). So I thought I would just merge
the
two - simple, huh.



Well, the first parameter of MsgReceive is the channel id. For pulses
that
comes from a channel (PulseChID):



// tell the OS to send a pulse upon interrupt

PulseChID = ChannelCreate(_NTO_CHF_UNBLOCK);

PulseCoID = ConnectAttach(0, 0, PulseChID, _NTO_SIDE_CHANNEL,0);

SIGEV_PULSE_INIT(&PulseEvent, PulseCoID,SIGEV_PULSE_PRIO_INHERIT,

PULSE_CODE, NULL);

PulseIntID = InterruptAttachEvent(TIME_IRQ,
&PulseEvent,_NTO_INTR_FLAGS_TRK_MSK);



For messages it comes from the name_open or _connect.



These each work but separately. The MsgReceive seems to say “only accept
from this channel”. I would like to be able to hang one MsgReceive to be
triggered on pulses (from interrupts in this case) or messages from
another
process like QNX4 had it. Is there a “accept from anyone” flag?



I found on this newsgroup something about _select_receive() but I’m not
sure
what that’s all about.



Any suggestions?

That’s what I was looking for! Thanks.


“Xiaodan Tang” <xtang@qnx.com> wrote in message
news:bcqjj0$gdp$1@nntp.qnx.com

Yeah, MsgReceive() only receives on one channel. It is designed that way,
so
you can have
more channel in a process (and have more thread blocked on these channel).

In your case, you probably want to make your pulse comming into the same
channel.

pulseCode = ConnectAttach(0, 0, <channel_come_back_from_name_open>,
…);

That should do it.

-xtang

Ken Price <> kprice@harscotrack.com> > wrote in message
news:bcqi87$mpm$> 1@inn.qnx.com> …
We’re migrating from 4.25 some applications that Receive either proxies
(timer proxy, trigger from another app, or from qnx_hint_attach) or
messages
(from other processes). I can’t seem to find a way for MsgReceive to
accept
from both.



I did find a good thread that explains pulses from interrupts like
qnx_hint_attach


(> http://groups.google.com/groups?q=qnx+irq+10&hl=en&lr=&ie=UTF-8&oe=UTF-8&se
lm=fae6e8db.0207191254.63011a59%40posting.google.com&rnum=1 is the start
of
it).



And after trial and error I got message passing to work (use name_open()
for
local, _connect() for remote node()). So I thought I would just merge
the
two - simple, huh.



Well, the first parameter of MsgReceive is the channel id. For pulses
that
comes from a channel (PulseChID):



// tell the OS to send a pulse upon interrupt

PulseChID = ChannelCreate(_NTO_CHF_UNBLOCK);

PulseCoID = ConnectAttach(0, 0, PulseChID, _NTO_SIDE_CHANNEL,0);

SIGEV_PULSE_INIT(&PulseEvent, PulseCoID,SIGEV_PULSE_PRIO_INHERIT,

PULSE_CODE, NULL);

PulseIntID = InterruptAttachEvent(TIME_IRQ,
&PulseEvent,_NTO_INTR_FLAGS_TRK_MSK);



For messages it comes from the name_open or _connect.



These each work but separately. The MsgReceive seems to say “only
accept
from this channel”. I would like to be able to hang one MsgReceive to
be
triggered on pulses (from interrupts in this case) or messages from
another
process like QNX4 had it. Is there a “accept from anyone” flag?



I found on this newsgroup something about _select_receive() but I’m not
sure
what that’s all about.



Any suggestions?

\