Kill all active workers.
        @wait: Seconds to wait until last worker ends.
               If None it waits forever.
325244
def killall(self, wait = None):
        
        self.queue.close()
        self.count_lock.acquire()
        self.kill(self.shared['workers'])
        self.count_lock.release()
        self.tasks.close()
        self.terminate()
        self.kill_event.wait(wait)
241821
def kill_child_processes() -> None:
    
    timeout_sec = 5
    for p in processes:
        try:
            p.wait(timeout_sec)
        except TimeoutExpired:
            # failed to close
            p.kill()
915572
def stop(*args)
      @kill = true
      if(args.include?(:force) || waiting?)
        begin
          @thread.raise Wakeup.new
        rescue Wakeup
          #ignore since we are the caller
        end
        sleep(0.01)
        @thread.kill if @thread.alive?
      end
      nil
    end
606593
public void kill() throws InterruptedException {
            // after sending SIGTERM, wait for the process to cease to exist
            long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(softKillWaitSeconds);
            kill(deadline);
        }
419374
def stop_all(wait=true)
      if @scripts_to_run['terminate']
        options = { "DB_TERMINATE_SAFETY" => "text:off" }
        @servers.each { |s| s.run_executable(@scripts_to_run['terminate'], options) unless s.state == 'stopped' }
      else
        @servers.each { |s| s.stop }
      end

      wait_for_all("stopped") if wait
      # unset dns in our local cached copy..
      @servers.each { |s| s.params['dns-name'] = nil } 
    end
445377
public void shutdown() {
	    if (shutdown) 
	    {
	        return;
	    }
	    shutdown = true;
	    synchronized (workers) 
	    {
	        for (int i = workers.size(); i > 0; i--) 
	        {
	        	systemExecute(exitTask);
	        }
	        waitConditionStrategy.signalAllWhenBlocking();
	    }
	}
671578
function checkRestartQueue() {
            // Kill one worker only if maximum count are working.
            if (restartQueue.length > 0 && listeningWorkersCount === workersCount && !currentRestartingPid) {
                var pid = restartQueue.shift();
                try {
                    // Store process id to wait for its finish.
                    currentRestartingPid = pid;
                    // Send SIGTERM signal to worker. SIGTERM starts graceful shutdown of worker inside it.
                    process.kill(pid);

                } catch(ex) {

                    // Reset current pid.
                    currentRestartingPid = null;

                    // If no process killed, try next in queue.
                    process.nextTick(checkRestartQueue);

                    // Fail silent on 'No such process'. May occur when kill message received after kill initiated but not finished.
                    if (ex.code !== 'ESRCH') {
                        throw ex;
                    }
                }
            }
        }
968067
def _kill_worker_threads(self):
        
        num_workers = len(self._worker_threads)

        if num_workers:
            _log.warning('killing %s active workers(s)', num_workers)
            for worker_ctx, gt in list(self._worker_threads.items()):
                _log.warning('killing active worker for %s', worker_ctx)
                gt.kill()
258358
def kill signal = 'TERM', wait = false
      Process.kill signal, self.pid
      val = status if wait
      @stdin.close
      @stdout.close
      @stderr.close
      val
    end
212870
public function kill()
    {
        $this->running = false;

        foreach ($this->workers as $worker) {
            $worker->kill();
        }
    }
249702
public void kill() {
    boolean killNow = false;
    synchronized(jobInitKillStatus) {
      jobInitKillStatus.killed = true;
      //if not in middle of init, terminate it now
      if(!jobInitKillStatus.initStarted || jobInitKillStatus.initDone) {
        //avoiding nested locking by setting flag
        killNow = true;
      }
    }
    if(killNow) {
      terminate(JobStatus.KILLED);
    }
  }
294360
def stop
      @bot.loggers.debug "[Stopping handler] Stopping all threads of handler #{self}: #{@thread_group.list.size} threads..."
      @thread_group.list.each do |thread|
        Thread.new do
          @bot.loggers.debug "[Ending thread] Waiting 10 seconds for #{thread} to finish..."
          thread.join(10)
          @bot.loggers.debug "[Killing thread] Killing #{thread}"
          thread.kill
        end
      end
    end
847623
public function killAndWait()
    {
        $status = 0;
        $this->kill();
        if ($this->pid > 0) {
            $pid = pcntl_wait($status);
            if ($pid == $this->pid) {
                $this->pid = -1;
            }
        }
    }
1327028
function closeAllWorkers() {
        Object.keys(cluster.workers).forEach(id => {

            // Get a handle on the worker process
            const worker = cluster.workers[id];

            // Check this worker isn't already done
            if (worker.state === "disconnected") {
                return;
            }

            // Tell the worker to shutdown
            worker.send("pluribus-shutdown");
            worker.disconnect();

            // If the worker is too slow, shut it down anyway
            const timeout = setTimeout(_ => {
                logger("Forcing", worker.process.pid, "to shutdown");
                worker.kill("SIGKILL");
            }, options.waitTimeout);

            // If the worker shuts down okay, cancel the forced shutdown
            worker.on("exit", function () {
                logger("Worker", worker.process.pid, "exited");
                clearTimeout(timeout);
            });
        });
    }
423415
private function waitForAllToFinish(): void
    {
        do {
            foreach ($this->workers as $key => $worker) {
                if (!$worker->isRunning()) {
                    unset($this->workers[$key]);
                }
            }
            usleep(10000);
            $this->printOutput();
        } while (\count($this->workers) > 0);
    }
935537
def stop(self):
        
        if not self.stopped():
            self._stop.set()
            for worker in self._workers:
                worker.join()
560651
def reap_all_workers(waitpid_flags=Process::WNOHANG)
      @waiting_for_reaper = waitpid_flags == 0
      begin
        loop do
          # -1, wait for any child process
          wpid, status = Process.waitpid2(-1, waitpid_flags)
          break unless wpid

          if worker = delete_worker(wpid)
            log "Reaped resque worker[#{status.pid}] (status: #{status.exitstatus}) queues: #{worker.queues.join(",")}"
          else
            # this died before it could be killed, so it's not going to have any extra info
            log "Tried to reap worker [#{status.pid}], but it had already died. (status: #{status.exitstatus})"
          end
        end
      rescue Errno::ECHILD, QuitNowException
      end
    end