On Tue, 26 Oct 2010, brandt@subnet.at wrote:
does anybody know how i can get the process id in win7 of every instance of three pd´s to use them for a watchdog, which is checking, if the instances are still alive and if not kill the one not responding and open it again.
[gf/getpid] would give you the pid of the server process, but on windows it will refuse to work because it's also supposed to give you the ppid at once, and getppid() does not exist in MinGW.
When pd starts the client process, it does two things that lose the pid : first it doesn't store the value anywhere at all, but also, it starts a shell that starts the client, so, it only ever knows the pid of the shell, and never the pid of the client.
If you want to know the pid of the client, you have to register a receive-symbol, let's say "pidstuff", and then you have to send a tcl message :
sys_gui("pd pidstuff [pid] ;\n");
But IIRC, proc pd doesn't work anymore in Pd 0.43, unless it's been changed recently in Pd 0.43 ... at the very least, there is code in the GridFlow library that adds back support for proc pd _if_ you are running Pd 0.43, so that existing code in GridFlow can continue to work. I don't know how GUI externals are supposed to continue to work under those circumstances... I haven't looked.
If it works, you will then receive a message on the receive-symbol you registered. You need to have registered a float-method (or equivalent list-method or anything-method) for the class of the object that is bound to the receive-symbol.
I don't know anything about pd's watchdog process pid.
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC