Dear list, I'm wrinting a perl program that works with different threads. Those threads depend on each other, not all in the same way. Some threads should stop when others are finished with their work, and again others are to be started afterwards. The current architecture I have in mind is that of a master thread controlling the others. I'm looking for a way to:
1. signal that a thread has finished its work, and find out which thread that is, 2. stopping another thread on that signal, 3. gathering the results from each of the two; thereby 4. I want to be able to start a new bunch of threads on demand. More verbose and concrete: I have six worker machines, M1 to M6, and a controller machine, M0. The perl program runs on the controller machine. This program is basically a dispatcher I control from a command line interface. A command causes two threads to be started, say on M1 and M2. One thread on M1 produces work, the other on M2 plots the network traffic. When M1 is finished, I want the thread M0 that caused the workload to signal to the dispatcher that M1 is finished. The dispatcher then shall signal M2 to stop monitoring. Afterwards, I want the results from both M1 and M2, preferably in form of a perl structure. First of all, is that possible? I have already looked at threads, threads::shared and the traditional fork(). With the standard IPC stuff, I'm able to signal and trap that in the master process with a signal handler. But I cannot, however, get the PID of the child that emitted the signal, thus I'm not able to send a SIGTERM to another process. I'm also not sure how I could get my result data. threads::shared allows me to share a perl structure I could fill, but I don't know how to signal the master thread. Passing a subroutine reference doesn't work, of other options I don't know. I'd very much appreciate any hints. Thanks in advance. # Eric -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/