how to get pid from a received pulse?

bridged with qdn.public.qnxrtp.devtools
Post Reply
Stephen Lau

how to get pid from a received pulse?

Post by Stephen Lau » Wed Jan 29, 2003 9:29 pm

I need to get the PID from a pulse my program has just
received - but the MsgInfo structures aren't updated in
the event of receiving a pulse. Is there any other way
I can get the PID of the process that triggered the pulse?

cheers,
steve

John Garvey

Re: how to get pid from a received pulse?

Post by John Garvey » Wed Jan 29, 2003 10:25 pm

Stephen Lau <slau@qm.com> wrote:
I need to get the PID from a pulse my program has just
received - but the MsgInfo structures aren't updated in
the event of receiving a pulse. Is there any other way
I can get the PID of the process that triggered the pulse?
From the online MsgReceive() docs:
A pulse was received. Unlike a message, you shouldn't reply to a pulse.
When a pulse is received, the kernel space allocated to hold it is
immediately released. The _msg_info structure isn't updated.

Since a pulse is an asynchronous communication event and is queued
by the kernel for later delivery there is no tie-in back to the
sender of the pulse (that process may not even exist any more).
Why do you need to know the pulse sender? A pulse typically is
self-encapsulating (using the code/value data within it); could
you store the pid in your pulse data perhaps?

Stephen Lau

Re: how to get pid from a received pulse?

Post by Stephen Lau » Wed Jan 29, 2003 10:36 pm

John Garvey wrote:
Since a pulse is an asynchronous communication event and is queued
by the kernel for later delivery there is no tie-in back to the
sender of the pulse (that process may not even exist any more).
Why do you need to know the pulse sender? A pulse typically is
self-encapsulating (using the code/value data within it); could
you store the pid in your pulse data perhaps?
Basically, my program uses spawn to launch a few other clients.
Those clients then start and register themselves with the original
program (let's call it the server). Since spawn returns me a pid,
I need to be able to map the clients back up to their spawned pid
on the server. I can't use the pulse data (I assume you mean the
..value field?), because I'm using it to hold another piece of
data.

I've had partial success using ConnectClientInfo() from the server
(using the .scoid field from the pulse struct), but it seems very
timing dependent. Sometimes it works, sometimes it doesn't...

Any ideas?

thanks for the quick response
cheers,
steve

Bill Caroselli

Re: how to get pid from a received pulse?

Post by Bill Caroselli » Thu Jan 30, 2003 12:20 am

Stephen Lau <slau@qm.com> wrote:
John Garvey wrote:

Since a pulse is an asynchronous communication event and is queued
by the kernel for later delivery there is no tie-in back to the
sender of the pulse (that process may not even exist any more).
Why do you need to know the pulse sender? A pulse typically is
self-encapsulating (using the code/value data within it); could
you store the pid in your pulse data perhaps?

Basically, my program uses spawn to launch a few other clients.
Those clients then start and register themselves with the original
program (let's call it the server). Since spawn returns me a pid,
I need to be able to map the clients back up to their spawned pid
on the server. I can't use the pulse data (I assume you mean the
.value field?), because I'm using it to hold another piece of
data.

I've had partial success using ConnectClientInfo() from the server
(using the .scoid field from the pulse struct), but it seems very
timing dependent. Sometimes it works, sometimes it doesn't...

Any ideas?

thanks for the quick response
cheers,
steve
The way I've dealt with this is to have 'client' processes "register"
with a server. The server returns a unique pulse for the client to
Pulse.

--
Bill Caroselli -- Q-TPS Consulting
1-(626) 824-7983
qtps@earthlink.net

Post Reply

Return to “qdn.public.qnxrtp.devtools”