Private method to add a thread object to the snapshot.

        @type  aThread: L{Thread}
        @param aThread: Thread object.
544365
def _add_thread(self, aThread):
        
##        if not isinstance(aThread, Thread):
##            if hasattr(aThread, '__class__'):
##                typename = aThread.__class__.__name__
##            else:
##                typename = str(type(aThread))
##            msg = "Expected Thread, got %s instead" % typename
##            raise TypeError(msg)
        dwThreadId = aThread.dwThreadId
##        if dwThreadId in self.__threadDict:
##            msg = "Already have a Thread object with ID %d" % dwThreadId
##            raise KeyError(msg)
        aThread.set_process(self)
        self.__threadDict[dwThreadId] = aThread
558266
public void cacheThreadLocalRawStore() {
    Long threadId = this.getId();
    RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore();
    if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) {
      LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " +
          this.getName() + " to threadRawStoreMap for future cleanup.");
      threadRawStoreMap.put(threadId, threadLocalRawStore);
    }
  }
191574
public void setThreadIDs(String[] threadIDs) throws IllegalArgumentException {
        int[] threads = null;
        if (threadIDs != null) {
            threads = new int[threadIDs.length];
            try {
                for (int i = 0; i < threads.length; i++) {
                    threads[i] = Integer.parseInt(threadIDs[i], 16);
                }
            } catch (NumberFormatException ex) {
                throw new IllegalArgumentException("Strings in the threadIDs array should be all in hexadecimal format");
            }
        }
        this.threadIDs = threads;
    }
1072317
@Override
    public Thread newThread(final Runnable r) {
        final Thread t = new Thread(r, threadNamePrefix + threadIdx.getAndIncrement());
        t.setDaemon(daemon);
        return t;
    }
1197297
function(threadId, callback) {
                var uploadQ = [];
                for (var i = 0; i < chatUploadQueue.length; i++) {
                    if (chatUploadQueue[i].threadId == threadId) {
                        uploadQ.push(chatUploadQueue[i]);
                    }
                }

                callback && callback(chatUploadQueue);
            }
1357950
public synchronized final void putThreadLocal(Object key, Object value)
    {
        if (sealed) onSealedMutation();
        if (threadLocalMap == null)
            threadLocalMap = new HashMap<Object,Object>();
        threadLocalMap.put(key, value);
    }
123179
def add_thread(self, checker, end_callback, source_code, parent):
        """"""
        parent_id = id(parent)
        thread = AnalysisThread(self, checker, source_code)
        self.end_callbacks[id(thread)] = end_callback
        self.pending_threads.append((thread, parent_id))
        logger.debug("Added thread %r to queue" % thread)
        QTimer.singleShot(50, self.update_queue)
404309
def threads_init(gtk=True):
    
    # enable X11 multithreading
    x11.XInitThreads()
    if gtk:
        from gtk.gdk import threads_init
        threads_init()
481435
private static <T> ThreadContext<T> getCurrentThreadContext(ThreadContext<T> threadContext)
    {
        return ((ThreadContextImpl<T>) threadContext).get();
    }
1258100
public @CheckForNull JvmThread forThread(@CheckForNull Thread needle) {
        if (needle == null) return null;

        for (JvmThread candidate: this) {
            final JvmThread jvmThread = candidate;
            if (needle.equals(jvmThread.getThread())) return jvmThread;
        }
        return null;
    }
887342
function() {
      var threadsToKeep = {};
      for (var tid in this.threads) {
        var thread = this.threads[tid];
        if (!thread.isEmpty)
          threadsToKeep[tid] = thread;
      }
      this.threads = threadsToKeep;
    }
1123866
def resume(self):
        
        if self.get_thread_count() == 0:
            self.scan_threads() # only refresh the snapshot if empty
        resumed = list()
        try:
            for aThread in self.iter_threads():
                aThread.resume()
                resumed.append(aThread)
        except Exception:
            for aThread in resumed:
                try:
                    aThread.suspend()
                except Exception:
                    pass
            raise
721584
def _threaded(self, *args, **kwargs):
        """"""

        for target in self.targets:
            result = target(*args, **kwargs)
            self.queue.put(result)
921132
public static final ThreadHistoryEvent created(long threadId, String threadName){
		return new ThreadHistoryEvent(threadId, threadName, OPERATION.CREATED);
	}
943924
def init_threads(t=None, s=None):
    """"""
    global THREAD, SIGNAL
    THREAD = t or dummyThread
    SIGNAL = s or dummySignal
1027644
public static Thread newThread(String name, Runnable runnable, boolean daemon) {
        Thread thread = new Thread(runnable, name);
        thread.setDaemon(daemon);
        return thread;
    }
1003255
private void prepareThreadManager(StreamConfiguration sc) {
    assert(!flacStreamIsOpen);
    if(MAX_THREADED_FRAMES > 0) {
      threadManager = new BlockThreadManager(this);
      threadedFrames = new Frame[MAX_THREADED_FRAMES];
      for(int i = 0; i < MAX_THREADED_FRAMES; i++) {
        threadedFrames[i]  = new Frame(this.streamConfig);
        threadManager.addFrameThread(threadedFrames[i]);
      }
    }
    else {
      threadManager = null;
    }
  }