Kill the current running process and cleanup. Note ---- The worker can start a new process when send is called again.
(self)
| 72 | pass |
| 73 | |
| 74 | def kill(self): |
| 75 | """Kill the current running process and cleanup. |
| 76 | |
| 77 | Note |
| 78 | ---- |
| 79 | The worker can start a new process when send is called again. |
| 80 | """ |
| 81 | if self._proc is not None: |
| 82 | # kill all child processes recursively |
| 83 | try: |
| 84 | _kill_child_processes(self._proc.pid) |
| 85 | except TypeError: |
| 86 | pass |
| 87 | try: |
| 88 | self._proc.kill() |
| 89 | except OSError: |
| 90 | pass |
| 91 | |
| 92 | # Join the child process to avoid zombie processes |
| 93 | self.join(timeout=1.0) |
| 94 | self._proc = None |
| 95 | |
| 96 | def join(self, timeout=None): |
| 97 | """Join the current process worker before it terminates. |
no test coverage detected