like the start! method, but checks for dead threads in the threadpool
 (which will happen after a fork())

 This will reset the state of the pool and any blocks registered will be
 lost


 @private
193631
def reopen_after_fork!
      # ok, we know that only the child process calls this, right?
      return false unless (@state == :running) or (@state == :paused)
      logger.debug { "#{self.class}##{__method__}" }

      @state = :running
      @mutex = Mutex.new
      @cond  = ConditionVariable.new
      @queue = []
      prune_dead_threads
      spawn_threadpool
    end
306517
def start_server
      @connect_lock.synchronize do
        begin
          raise "Adapter already set" if @adapter
          @adapter = Lock.new(@builder.build.last)
          raise "Server already set" if @server
          @server = Server.new(@adapter, @options)
          @thread = Thread.new { @server.run }
          sleep 0.1 until @server.running?
        rescue => ex
          @adapter.close if @adapter
          @adapter = nil
          @server = nil
          @thread = nil
          warn "Moneta::Shared - Failed to start server: #{ex.message}"
        end
      end
    end
70666
def __start(self):
        
        thread = Thread(target=self.__loop, args=())
        thread.daemon = True  # daemonize thread
        thread.start()
        self.__enabled = True
615872
def startup
      enable_gc_optimizations
      if Thread.current == Thread.main
        register_signal_handlers
        prune_dead_workers
      end
      run_hook :before_first_fork
      register_worker

      # Fix buffering so we can `rake resque:work > resque.log` and
      # get output from the child in there.
      $stdout.sync = true
    end
863777
def try_start
      return if @backoff.wait?
      @backoff.started
      @self_started = true
      @killed = false
      if @pid = fork
        @pids << @pid
        # still in the listener
        log "Forked worker #{@pid}"
      else
        # In case we get a signal before resque is ready for it.
        Resqued::Listener::ALL_SIGNALS.each { |signal| trap(signal, 'DEFAULT') }
        trap(:QUIT) { exit! 0 } # If we get a QUIT during boot, just spin back down.
        $0 = "STARTING RESQUE FOR #{queues.join(',')}"
        resque_worker = @worker_factory.call(queues)
        @config.after_fork(resque_worker)
        resque_worker.work(@interval || 5)
        exit 0
      end
    end
1155983
function() {
			var forkContext = this.forkContext;

			if (forkContext.reachable) {
				getReturnContext(this).returnedForkContext.add(forkContext.head);
				forkContext.replaceHead(forkContext.makeUnreachable(-1, -1));
			}
		}
1044486
int adjustPoolSize(int poolSize, int poolAdjustment) {
        if (threadPool == null)
            return poolSize; // arguably should return 0, but "least change" is safer... This happens during shutdown.

        int newPoolSize = poolSize + poolAdjustment;
        lastAction = LastAction.NONE;

        if (poolAdjustment != 0) {
            // don't shrink below coreThreads
            if (poolAdjustment < 0 && newPoolSize >= coreThreads) {
                lastAction = LastAction.SHRINK;
                setPoolSize(newPoolSize);
            } else if (poolAdjustment > 0 && newPoolSize <= maxThreads) {
                lastAction = LastAction.GROW;
                setPoolSize(newPoolSize);
            } else {
                newPoolSize = poolSize;
            }
        }

        return newPoolSize;
    }
734281
def update_polling_pool(key, thread)
      unless @pool.size < @max_threads
        _, thread = @pool.shift
        Thread.kill(thread)
      end
      @pool[key] = thread
    end
1112957
def start_blocking(self):
        

        self._cav_started.clear()
        self.start()
        self._cav_started.wait()
1037096
def reopen_after_fork!
#       logger.debug { "#{self.class}##{__method__}" }
      @mutex = Monitor.new
      @setup_watcher_mutex = Monitor.new

      # XXX: need to test this w/ actor-style callbacks
      
      @state = :running
      @callbacks.values.flatten.each { |cb| cb.reopen_after_fork! if cb.respond_to?(:reopen_after_fork!) }
      @outstanding_watches.values.each { |set| set.clear }
      nil
    end
482262
boolean manageIdlePool(ThreadPoolExecutor threadPool, long intervalCompleted) {

        // Manage the intervalCompleted count
        if (intervalCompleted == 0 && threadPool.getActiveCount() == 0) {
            consecutiveIdleCount++;
        } else {
            consecutiveIdleCount = 0;
        }

        if (consecutiveIdleCount >= IDLE_INTERVALS_BEFORE_PAUSE) {
            pause();
            lastAction = LastAction.PAUSE;
            return true;
        }

        return false;
    }
573416
public void initPool(String name) {
        running = true;
        for (int i = size; --i >= 0; ) {
            PoolThread thread = new PoolThread();
            threadPool.add(thread);
            thread.setName(String.format("%s Handler", name));
            thread.start();
        }
    }
679164
function _runIfLocked() {
    var self = this;

    self._clusterUtils._setLock(self.lockKey, function(err, lock) {
        if (err) {
            throw err;
        } else if (!lock) {
            return;
        }

        process.nextTick(self._func);
    });
}
1295960
private void ensureWatchThreadRunning() {
		if (!threadRunning) {
			thread = new Thread(watchThread);
			thread.setDaemon(true);
			thread.start();
			watchThread.setThread(thread);
			watchThread.updateName();
			threadRunning = true;
		}
	}
887342
function() {
      var threadsToKeep = {};
      for (var tid in this.threads) {
        var thread = this.threads[tid];
        if (!thread.isEmpty)
          threadsToKeep[tid] = thread;
      }
      this.threads = threadsToKeep;
    }
1344375
function startBlock() {
            blockStack.push({
                let: { initialized: false, uninitialized: false },
                const: { initialized: false, uninitialized: false }
            });
        }
1264388
def startall(self, wait=False, **kwdargs):
        
        self.logger.debug("startall called")
        with self.regcond:
            while self.status != 'down':
                if self.status in ('start', 'up') or self.ev_quit.is_set():
                    # For now, abandon additional request to start
                    self.logger.error("ignoring duplicate request to start thread pool")
                    return

                self.logger.debug("waiting for threads: count=%d" %
                                  self.runningcount)
                self.regcond.wait()

            #assert(self.status == 'down')
            if self.ev_quit.is_set():
                return

            self.runningcount = 0
            self.status = 'start'
            self.workers = []
            if wait:
                tpool = self
            else:
                tpool = None

            # Start all worker threads
            self.logger.debug("starting threads in thread pool")
            for i in range(self.numthreads):
                t = self.workerClass(self.queue, logger=self.logger,
                                     ev_quit=self.ev_quit, tpool=tpool,
                                     **kwdargs)
                self.workers.append(t)
                t.start()

            # if started with wait=True, then expect that threads will register
            # themselves and last one up will set status to "up"
            if wait:
                # Threads are on the way up.  Wait until last one starts.
                while self.status != 'up' and not self.ev_quit.is_set():
                    self.logger.debug("waiting for threads: count=%d" %
                                      self.runningcount)
                    self.regcond.wait()
            else:
                # otherwise, we just assume the pool is up
                self.status = 'up'
            self.logger.debug("startall done")