process programming

J

jonathan

I have a didactic program about process programming.
One master has two slave and if the second slave end before the first I
have to do something.
How can set this condition? I tried with a wait() inside the master
checking if its returned value is the same of pidslave2.
Is it wrong?

Thanks
best regards
 
E

Erik Wikström

I have a didactic program about process programming.
One master has two slave and if the second slave end before the first I
have to do something.
How can set this condition? I tried with a wait() inside the master
checking if its returned value is the same of pidslave2.
Is it wrong?

This is platform dependent, you should ask in a unix/posix programming
group (assuming that is your platform. There is no standard C++ way of
doing this.
 
P

Pascal J. Bourguignon

Probably.

You have to define the life cycle of your master and slaves. Usually,
when we talk of IPC (implied by "master" and "slave"), the processes
don't communicate only at birth and death.

If you still want to use fork/wait, check the various wait functions
(man 2 wait): wait, waitpid, waitid.

This is platform dependent, you should ask in a unix/posix programming
group (assuming that is your platform. There is no standard C++ way of
doing this.

Well there are portable C++ libraries for IPC.
For example: http://dudka.cz/sharelib
(google for: IPC C++ library)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top