Hi,
I'm currently writing a program that tries to read (from a message
queue) either a message of type 123 or a one of type 111.
I've tried the following code but it seems that it is not working:
// reads from the message queue
if ( msgrcv(qid, &mesg, sizeof(mesg), 123 || 111, 1) < 0 )
/** error occurs and halt **/
if (mesg.mtype == 123) {
....
}
else {
....
}
Is there a way to write a code that can read either a message from the
message queue of type A or a one of type B /without/ busy waiting??
Thankx
cc: comp.unix.progr ammer
I'm currently writing a program that tries to read (from a message
queue) either a message of type 123 or a one of type 111.
I've tried the following code but it seems that it is not working:
// reads from the message queue
if ( msgrcv(qid, &mesg, sizeof(mesg), 123 || 111, 1) < 0 )
/** error occurs and halt **/
if (mesg.mtype == 123) {
....
}
else {
....
}
Is there a way to write a code that can read either a message from the
message queue of type A or a one of type B /without/ busy waiting??
Thankx
cc: comp.unix.progr ammer
Comment