<!doctype html public “-//w3c//dtd html 4.0 transitional//en”>
Ok this is my problem:I have an application that is supposed to receive both QNX-messages
and socket
connections at the same time which means that I have to make select()
react
to both. This is done by using (the poorly documented) function _select_receive()
which when present is called automatically from within the normal select().
Here is some simplified a-little-bit-more-than-pseudo code that shows the problem:
pid_t _select_receive(pid_t proxy) {
char buf[DEFAULT_RECV_SIZE];
pid = Receive(0, buf, DEFAULT_RECV_SIZE );
// The "documentation" says that this function is
not
// allowed to return until the proxy it was passed
has been
// triggered.
while (pid != proxy){
// Do stuff with the QNX-messages
that was received.
HandleQNXReceive(pid, buf,
DEFAULT_RECV_SIZE);
pid = Receive(0, buf, DEFAULT_RECV_SIZE
);
}
return pid;
}
main()
{
while(1){
select(usual parameters);
HandleSelectReturnStuff();
// The select() above will
only release for timeouts and regular file descriptor events
// as usual. Not for QNX-messages.
In the case where you only are using sockets,
// one can write code that
releases the select() and the event is taken care of. Depending
// on the event, you might
want to go into select() again with for instance a new timeout
// or a new set of parameters.
My problem now is that when an event comes in as a QNX-
// message and I also then
want to change the timeout lets say, how do I do that from
// within the _select_receive()
function? You see, when a QNX-message has been
// handled, select() calls
_select_receive() again internally, not letting my main program
// do any actions.
}
}
Looks like I wrote most of my question in that comment :slight_smile:
Anyway, *how* can I force the select() in the main function to release
when I'm inside the _select_receive() function???
This is a showstopper problem right now and I have a dead-line 1:st
of March
so please, don't hesitate to answer :slight_smile:
/Lars