IDbgpThreadAcceptor
965162
public void acceptDbgpThread(IDbgpSession session, IProgressMonitor monitor)
	{
		SubMonitor sub = SubMonitor.convert(monitor, 100);
		try
		{
			DbgpException error = session.getInfo().getError();
			if (error != null)
			{
				throw error;
			}
			session.configure(target.getOptions());
			session.getStreamManager().addListener(this);

			final boolean breakOnFirstLine = // target.breakOnFirstLineEnabled()
			// ||
			isAnyThreadInStepInto();
			VdmThread thread = new VdmThread(target, session, this);
			thread.initialize(sub.newChild(25));
			addThread(thread);

			final boolean isFirstThread = waitingForThreads;
			if (isFirstThread)
			{
				waitingForThreads = false;
			}
			if (isFirstThread || !isSupportsThreads(thread))
			{
				SubMonitor child = sub.newChild(25);
				target.breakpointManager.initializeSession(thread.getDbgpSession(), child);
				child = sub.newChild(25);
				if (configurator != null)
				{
					configurator.initializeBreakpoints(thread, child);
				}
			}

			DebugEventHelper.fireCreateEvent(thread);

			final boolean stopBeforeCode = thread.getDbgpSession().getDebugOptions().get(DebugOption.ENGINE_STOP_BEFORE_CODE);
			boolean executed = false;
			if (!breakOnFirstLine)
			{
				if (stopBeforeCode || !hasBreakpointAtCurrentPosition(thread))
				{
					thread.resumeAfterAccept();
					executed = true;
				}
			} else
			{
				if (stopBeforeCode || !isValidStack(thread))
				{
					thread.initialStepInto();
					executed = true;
				}
			}
			if (!executed)
			{
				if (!thread.isStackInitialized())
				{
					thread.updateStack();
				}
				DebugEventHelper.fireChangeEvent(thread);
				DebugEventHelper.fireSuspendEvent(thread, DebugEvent.CLIENT_REQUEST);
			}
			sub.worked(25);
			fireThreadAccepted(thread, isFirstThread);
		} catch (Exception e)
		{
			try
			{
				target.terminate();
			} catch (DebugException e1)
			{
			}
			VdmDebugPlugin.log(e);
		} finally
		{
			sub.done();
		}
	}
560200
@Override
    public void attachThreadToDevice(long threadId, Integer deviceId) {
        val t = Thread.currentThread();
        String name = "N/A";
        if (t.getId() == threadId)
            name = t.getName();

        List<Integer> devices = new ArrayList<>(CudaEnvironment.getInstance().getConfiguration().getAvailableDevices());
        logger.trace("Manually mapping thread [{} - {}] to device [{}], out of [{}] devices...", threadId,
                name, deviceId, devices.size());
        affinityMap.put(threadId, deviceId);
    }
753130
public void dbgpPacketReceived(int sessionId, IDbgpRawPacket content)
	{
		append(new VdmDebugLogItem(Messages.ItemType_Input, sessionId, content));
	}
28496
public void addDispatcher(String dispatcherId, int threadsCount) {
        synchronized (dispatchers) {
            if (dispatchers.containsKey(dispatcherId)) {
                return;
            }

            ActorDispatcher dispatcher = new ActorDispatcher(dispatcherId, ThreadPriority.LOW, this,
                    Runtime.isSingleThread() ? 1 : threadsCount);

            dispatchers.put(dispatcherId, dispatcher);
        }
    }
459873
public static void printThreadStackTrace(TraceComponent logger, Thread thread) {
        if (logger.isDebugEnabled()) {
            chTrace.traceThreadStack(logger, thread);
        }
    }
707186
public static void addThreadIdentityService(ThreadIdentityService tis) {
        if (tis != null) {
            threadIdentityServices.add(tis);
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "A ThreadIdentityService implementation was added.", tis.getClass().getName());
            }
        }
    }
1105539
@Override
    public void attachThreadToDevice(Thread thread, Integer deviceId) {
        attachThreadToDevice(thread.getId(), deviceId);
    }
128623
public synchronized void addAdapter(int pid, InternalClientResponseAdapter adapter)
    {
        final ImmutableMap.Builder<Integer, InternalClientResponseAdapter> builder = ImmutableMap.builder();
        builder.putAll(m_adapters);
        builder.put(pid, adapter);
        m_adapters = builder.build();
    }
1041810
public int getIdleThreads()
   {
      if (executor instanceof ThreadPoolExecutor)
      {
         final ThreadPoolExecutor tpe = (ThreadPoolExecutor)executor;
         return tpe.getPoolSize() - tpe.getActiveCount();
      }
      return -1;
   }
1072858
function bindIndicators(indicator) {
    // Parent process will send three type of data
    const collectorHandler = {
        'process': function (value) {
            indicator.rss = value.rss;
            indicator.heapTotal = value.heapTotal;
            indicator.heapUsed = value.heapUsed;
        },
        'os': function (value) {
            indicator.totalMem = value.totalMem;
            indicator.freeMem = value.freeMem;
            indicator.cpus = value.cpus;
        },
        'v8': function (value) {
            indicator.newSpace = value.heapSpace[0];
            indicator.oldSpace = value.heapSpace[1];
            indicator.codeSpace = value.heapSpace[2];
            indicator.mapSpace = value.heapSpace[3];
            indicator.largeObjectSpace = value.heapSpace[4];
        }
    }

    process.on('message', (msg) => {
        if (Array.isArray(msg)) {
            msg.forEach((data) => {
                let handler = collectorHandler[data.type];
                if (typeof handler === 'function') collectorHandler[data.type](data.value);
            });
        }
    });
}
678874
function(eventName, cpuNumber, pid, ts, eventBase) {
      var event = kswapdWakeRE.exec(eventBase.details);
      if (!event)
        return false;

      var tgid = parseInt(eventBase.tgid);

      var nid = parseInt(event[1]);
      var order = parseInt(event[2]);

      var kthread = this.importer.getOrCreateKernelThread(
          eventBase.threadName, tgid, pid);

      if (kthread.openSliceTS) {
        if (order > kthread.order) {
          kthread.order = order;
        }
      } else {
        kthread.openSliceTS = ts;
        kthread.order = order;
      }
      return true;
    }
1171386
@SuppressWarnings("deprecation") // in this case we really want to use PeriodicWork.logger since it reports the impl class
    public final void doRun() {
        try {
            if(thread!=null && thread.isAlive()) {
                logger.log(this.getSlowLoggingLevel(), "{0} thread is still running. Execution aborted.", name);
                return;
            }
            thread = new Thread(new Runnable() {
                public void run() {
                    logger.log(getNormalLoggingLevel(), "Started {0}", name);
                    long startTime = System.currentTimeMillis();
                    long stopTime;

                    StreamTaskListener l = createListener();
                    try {
                        l.getLogger().printf("Started at %tc%n", new Date(startTime));
                        ACL.impersonate(ACL.SYSTEM);

                        execute(l);
                    } catch (IOException e) {
                        Functions.printStackTrace(e, l.fatalError(e.getMessage()));
                    } catch (InterruptedException e) {
                        Functions.printStackTrace(e, l.fatalError("aborted"));
                    } finally {
                        stopTime = System.currentTimeMillis();
                        try {
                            l.getLogger().printf("Finished at %tc. %dms%n", new Date(stopTime), stopTime - startTime);
                        } finally {
                            l.closeQuietly();
                        }
                    }

                    logger.log(getNormalLoggingLevel(), "Finished {0}. {1,number} ms",
                            new Object[]{name, stopTime - startTime});
                }
            },name+" thread");
            thread.start();
        } catch (Throwable t) {
            LogRecord lr = new LogRecord(this.getErrorLoggingLevel(), "{0} thread failed with error");
            lr.setThrown(t);
            lr.setParameters(new Object[]{name});
            logger.log(lr);
        }
    }
230604
public void onChildThreadLaunchBegin()
  {
    _threadCount.incrementAndGet();
    
    int startCount = _startingCount.decrementAndGet();

    if (startCount < 0) {
      _startingCount.set(0);
      
      new IllegalStateException().printStackTrace();
    }

    _createCountTotal.incrementAndGet();
    
    wakeIfLowIdle();
  }
568158
private static Calendar _getThreadCalendar(PageContext pc, TimeZone tz) {
	Calendar c = _calendar.get();
	c.clear();
	if (tz == null) tz = ThreadLocalPageContext.getTimeZone(pc);
	c.setTimeZone(tz);
	return c;
    }
866849
def enable_thread_logging(exception_callback=None):
    
    global logged_thread_enabled, Thread
    LoggedThread.exception_callback = exception_callback
    Thread = threading.Thread = LoggedThread
    logged_thread_enabled = True
101973
@Override
  public void onThreadBegin()
  {
    _threadCount.incrementAndGet();
    
    int startCount = _startingCount.decrementAndGet();

    if (startCount < 0) {
      _startingCount.set(0);
      
      new IllegalStateException().printStackTrace();
    }

    _createCountTotal.incrementAndGet();
    
    update();
  }
1195860
@Override
    protected void notifyDispatcher() {
        if (threads != null) {
            synchronized (threads) {
                threads.notifyAll();
                for (Thread thread : threads) {
                    ((DispatcherThread) thread).setChanged(true);
                }
            }
        }
    }