in reply to Re^3: Kill a serial of jobs with a button click in Perl/TK
in thread Kill a serial of jobs with a button click in Perl/TK
kill, AFAIK, only works on running processes.
If you think of the kill(2) system call, this is wrong. You can send signals to all processes, not only those that are currently running. (That limitation would make signals quite useless on all single-core systems, where only one process can be running at any point of time. You could only send signals to the own process.)
If they are executing sequentially, only one of them is "running", the rest is ... waiting? queued?
Tk::ExecuteCommand creates "background" processes, i.e. the processes are started and execute_command() returns before the process just started terminates. If you issue several execute_command() calls (for different instances of Tk::ExecuteCommand), you create several processes, running in parallel.
Update: I'm not quite sure about the previous paragraph. execute_command() calls several Tk methods that allow Tk to continue working, but execute_command() returns only after it considers the command to have finished ($self->{'-finish'} changes). Tk continues to handle events, so by clicking another button, another execute_command() may run.
(what I want to say is: they probably are not "processes" yet)
This is an instance of Tk::ExecuteCommand where either execute_command() has not yet been called or the executed child process has already terminated. There seems to be no method that can be used to test if the process is still running, unfortunately. The documentation does not detail what happens when a process terminates or when the methods get_status() and kill_command() are called before execute_command().
Looking at the source code gives some hints:
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Kill a serial of jobs with a button click in Perl/TK
by soonix (Chancellor) on May 25, 2015 at 11:33 UTC | |
by Janish (Sexton) on May 26, 2015 at 06:07 UTC | |
|
Re^5: Kill a serial of jobs with a button click in Perl/TK
by Janish (Sexton) on May 26, 2015 at 06:02 UTC |