@see: L{get_tid}

        @rtype:  L{Thread}
        @return: Thread where the event occured.
484216
def get_thread(self):
        
        tid     = self.get_tid()
        process = self.get_process()
        if process.has_thread(tid):
            thread = process.get_thread(tid)
        else:
            # XXX HACK
            # The thread object was missing for some reason, so make a new one.
            thread = Thread(tid)
            process._add_thread(thread)
        return thread
575891
def get_pid(self):
        
        if self.dwProcessId is None:
            if self.__process is not None:
                # Infinite loop if self.__process is None
                self.dwProcessId = self.get_process().get_pid()
            else:
                try:
                    # I wish this had been implemented before Vista...
                    # XXX TODO find the real ntdll call under this api
                    hThread = self.get_handle(
                                        win32.THREAD_QUERY_LIMITED_INFORMATION)
                    self.dwProcessId = win32.GetProcessIdOfThread(hThread)
                except AttributeError:
                    # This method really sucks :P
                    self.dwProcessId = self.__get_pid_by_scanning()
        return self.dwProcessId
520883
def id(self):
        
        if not hasattr(self, '_id'):
            self._id = str(threading.current_thread().ident + id(self))[-6:]
        return self._id
312007
def __cleanup_thread(self, event):
        
        tid = event.get_tid()

        # Cleanup running breakpoints
        try:
            for bp in self.__runningBP[tid]:
                self.__cleanup_breakpoint(event, bp)
            del self.__runningBP[tid]
        except KeyError:
            pass

        # Cleanup hardware breakpoints
        try:
            for bp in self.__hardwareBP[tid]:
                self.__cleanup_breakpoint(event, bp)
            del self.__hardwareBP[tid]
        except KeyError:
            pass

        # Cleanup set of threads being traced
        if tid in self.__tracing:
            self.__tracing.remove(tid)
1041810
public int getIdleThreads()
   {
      if (executor instanceof ThreadPoolExecutor)
      {
         final ThreadPoolExecutor tpe = (ThreadPoolExecutor)executor;
         return tpe.getPoolSize() - tpe.getActiveCount();
      }
      return -1;
   }
1269949
def poll():
    
    event_ptr = ffi.new('SDL_Event *')
    while lib.SDL_PollEvent(event_ptr):
        yield Event._from_ptr(event_ptr)
        event_ptr = ffi.new('SDL_Event *')
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;
    }
1269737
public static int getThreadID() {
		 StackInfo result = MDC.get();
		 return result == null ? HpelHelper.getIntThreadId() : result.threadId;
	 }
592881
static ThreadTrace getThreadTrace() {
    ThreadTrace t = traces.get();
    if (t == null) {
      t = new ThreadTrace();
      t.prettyPrint = defaultPrettyPrint;
      traces.set(t);
    }
    return t;
  }
780865
def run(self):
        
        try:
            threading.Thread.run(self)
        except Exception:
            t, v, tb = sys.exc_info()
            error = traceback.format_exception_only(t, v)[0][:-1]
            tback = (self.name + ' Traceback (most recent call last):\n' +
                     ''.join(traceback.format_tb(tb)))
            self.fifo.put((self.name, error, tback))
1367007
public ThreadUsage getThreadUsage() {
        ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean();

        ThreadUsage threadUsage = new ThreadUsage();
        long[] threadIds = threadMxBean.getAllThreadIds();
        threadUsage.liveThreadCount = threadIds.length;

        for (long tId : threadIds) {
            ThreadInfo threadInfo = threadMxBean.getThreadInfo(tId);
            threadUsage.threadData.put(Long.toString(tId), new ThreadData(
                    threadInfo.getThreadName(), threadInfo.getThreadState()
                            .name(), threadMxBean.getThreadCpuTime(tId)));

        }
        return threadUsage;
    }
726564
async def _thread_coro(self, *args):
        
        return await self._loop.run_in_executor(
            self._executor, self._function, *args)
312281
def get_thread(self, dwThreadId):
        
        self.__initialize_snapshot()
        if dwThreadId not in self.__threadDict:
            msg = "Unknown thread ID: %d" % dwThreadId
            raise KeyError(msg)
        return self.__threadDict[dwThreadId]
113194
public Thread getExecutingThread() {
		synchronized (this) {

			if (this.executingThread == null) {
				if (this.taskName == null) {
					this.executingThread = new Thread(this);
				}
				else {
					this.executingThread = new Thread(this, getTaskNameWithIndex());
				}
			}

			return this.executingThread;
		}
	}
684544
private static Calendar _getThreadCalendar(Locale l, TimeZone tz) {
	Calendar c = _localeCalendar.get(tz, l);
	if (tz == null) tz = ThreadLocalPageContext.getTimeZone();
	c.setTimeZone(tz);
	return c;
    }
287390
public void printStack(long tid) throws IOException {
		System.out.printf("%n Stack trace of thread %d:%n", tid);

		ThreadInfo info = view.vmInfo.getThreadInfo(tid, 20);
		if (info == null) {
			System.err.println(" TID not exist:" + tid);
			return;
		}
		printSingleThread(info);
		System.out.flush();
	}
814225
public static int getTotalThreadCount() {
		ThreadGroup parentThread = Thread.currentThread().getThreadGroup();
		while(null != parentThread.getParent()) {
			parentThread = parentThread.getParent();
		}
		return parentThread.activeCount();
	}