MsgReceive & Channel ID question

Hi

i have a main that creates 2 threads

each thread uses MsgReceive to wait for a Pulse.

in the main i create a channel that i use.in both threads

My question is , can i use the same channel as parameter in the MsgReceive
functions used in both threads ?
Or should i create a new channelid for each of my threads ?

Johan
(newbie)

Sagaert Johan <sagaert.j@belgacom.net> wrote:

Hi

i have a main that creates 2 threads

each thread uses MsgReceive to wait for a Pulse.

in the main i create a channel that i use.in both threads

My question is , can i use the same channel as parameter in the MsgReceive
functions used in both threads ?
Or should i create a new channelid for each of my threads ?

It depends.

The same channel can be used by both threads. BUT, you can’t specify/target
a particular thread with a particular pulse. And, it shouldn’t (normally)
matter.

Usual structure of a server:

/* setup /
/
launch one or more threads into main-loop function */
while( 1 )
{
rcvid = MsgReceive()
if ( ! rcvid )
{
switch( pulse_code )
{
case PULSE_TYPE_ONE
case PULSE_TYPE_TWO

}
} else
{
switch( msg_type )
{
case MSG_TYPE_ONE
case MSG_TYPE_TWO

}
}
}

-David


QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.