Bill Caroselli <qtps@earthlink.net> wrote:
BC > Lyle Beaulac <Lyle_C_Beaulac@attcanada.ca> wrote:
BC > LB > In the supporting documentation for select(), there is a tantalising glimpse
BC > LB > “under the covers” of the select() call, where it is mentioned that select()
BC > LB > calls a function named _select_receive(), which in turn sets up a Receive()
BC > LB > call specifically on its own proxy. The tantalising bit is where it is
BC > LB > hinted that one may write one’s own _select_receive() function and perform
BC > LB > QNX IPC operations behind select()'s back, so to speak, by calling Receive()
BC > LB > on all pids.
BC > LB > I figured this would be pretty useful for, say, having one’s daemon (like,
BC > LB > say, ntpd), respond to a sin ver query with the version of the daemon. Other
BC > LB > applications would no doubt spring to mind…
BC > LB > Unfortunately, I’m not enough of a QNX maven to work out the necessary
BC > LB > structure of the default _select_receive() call just from the hints given in
BC > LB > the select() docs. Anyone out there who would be willing to share this
BC > LB > secret?
BC > This is copied from an old post right here in this newsgroup.
BC > _select_receive( pid_t proxyPid )
BC > {
BC > pid_t pid;
BC > while (1)
BC > {
BC > // receive whatever is available
BC > pid = Receive( 0, buffer, len );
BC > // if it is our proxy or error return
BC > if( (pid == proxyPid )
BC > || (pid == -1) )
BC > return pid;
BC > // it must be a QNX message - handle it here
BC > // you might wayt to call a message handler to
BC > // keep _select_receive() simple
BC > // messageHandler( pid, buffer, len );
BC > }
BC > // keep compiler happy
BC > return(0);
BC > }
Many thanks to ped for screwing up the indent level.
Will the damn character EVER get fixed in ped/photon?
I have now noticed that this same bug gets carried
through to the Momentics IDE editor!