Found 171569 results in 30160 files, showing top 50 files (show more).
chromium.googlesource.com/arc/arc:third_party/chromium-ppapi/native_client_sdk/src/libraries/third_party/pthreads-win32/implement.h: [ master, ] c++
185:   DWORD thread;			/* Win32 thread ID */
502:   ptw32_thread_t * thread;
158:   HANDLE threadH;		/* Win32 thread handle - POSIX thread is invalid if threadH == 0 */
162:   ptw32_mcs_lock_t threadLock;	/* Used for serialised access to public thread state */
246:   pthread_t ownerThread;
346:   void *threads;
350: typedef struct ThreadParms ThreadParms;
352: struct ThreadParms
401: typedef struct ThreadKeyAssoc ThreadKeyAssoc;
403: struct ThreadKeyAssoc
505:   ThreadKeyAssoc *nextThread;
507:   ThreadKeyAssoc *prevThread;
152: typedef struct ptw32_thread_t_       ptw32_thread_t;
155: struct ptw32_thread_t_
575: #define PTW32_THREAD_REUSE_EMPTY ((ptw32_thread_t *)(size_t) 1)
198: struct pthread_attr_t_
234: struct pthread_mutex_t_
273: struct pthread_mutexattr_t_
302: struct pthread_spinlock_t_
326: struct pthread_barrier_t_
336: struct pthread_barrierattr_t_
341: struct pthread_key_t_
360: struct pthread_cond_t_
378: struct pthread_condattr_t_
385: struct pthread_rwlock_t_
396: struct pthread_rwlockattr_t_
133:   PThreadStateInitial = 0,	/* Thread not running                   */
134:   PThreadStateRunning,		/* Thread alive & kicking               */
135:   PThreadStateSuspended,	/* Thread alive but suspended           */
136:   PThreadStateCancelPending,	/* Thread alive but                     */
138:   PThreadStateCanceling,	/* Thread alive but is                  */
141:   PThreadStateExiting,		/* Thread alive but exiting             */
143:   PThreadStateLast,             /* All handlers have been run and now   */
145:   PThreadStateReuse             /* In reuse pool.                       */
147: PThreadState;
957: #define _endthreadex ExitThread
129:    * This enumeration represents the state of the thread;
130:    * The thread is still "alive" if the numeric value of the
157:   unsigned __int64 seqNumber;	/* Process-unique thread sequence number */
159:   pthread_t ptHandle;		/* This thread's permanent pthread_t handle */
160:   ptw32_thread_t * prevReuse;	/* Links threads on reuse stack */
242:   int recursive_count;		/* Number of unlocks a thread needs to perform
263:  * Node used to manage per-thread lists of currently-held robust mutexes.
407:    *      This structure creates an association between a thread and a key.
409:    *      destroy routine for thread specific data registered by a user upon
410:    *      exiting a thread.
416:    *         T - Thread that has called pthread_setspecific(Kn)
417:    *            (head of chain is thread->keys)
436:    *      general lock (guarding the row) and the thread's general
440:    *      until both the key is deleted and the thread has called the
442:    *      to be freed as soon as either thread or key is concluded.
445:    *      key and thread locks are acquired consistently in the order
446:    *      "key lock then thread lock". An exception to this exists
447:    *      when a thread calls the destructors, however, this is done
450:    *      An association is created when a thread first calls
455:    *      thread calls the key destructor function on thread exit, or
459:    *      thread
460:    *              reference to the thread that owns the
462:    *              thread struct itself. Since the association is
463:    *              destroyed before the thread exits, this can never
464:    *              point to a different logical thread to the one that
465:    *              created the assoc, i.e. after thread struct reuse.
492:    *      1)      As soon as either the key or the thread is no longer
574: /* Thread Reuse stack bottom marker. Must not be NULL or any valid pointer to memory. */
578: extern ptw32_thread_t * ptw32_threadReuseTop;
579: extern ptw32_thread_t * ptw32_threadReuseBottom;
593: extern ptw32_mcs_lock_t ptw32_thread_reuse_lock;
626:   void ptw32_robust_mutex_remove(pthread_mutex_t* mutex, ptw32_thread_t* otp);
644:   void ptw32_threadReusePush (pthread_t thread);
648:   int ptw32_setthreadpriority (pthread_t thread, int policy, int priority);
659:   void ptw32_callUserDestroyRoutines (pthread_t thread);
661:   int ptw32_tkAssocCreate (ptw32_thread_t * thread, pthread_key_t key);
6:  * Keeps all the internals out of pthread.h
10:  *      Pthreads-win32 - POSIX Threads Library for Win32
224:   pthread_mutex_t lock;
248: 				   threads. */
267:   pthread_mutex_t mx;
308:     pthread_mutex_t mutex;	/* mutex if single cpu.            */
354:   pthread_t tid;
362:   long nWaitersBlocked;		/* Number of threads blocked            */
363:   long nWaitersGone;		/* Number of threads timed out          */
364:   long nWaitersToUnblock;	/* Number of threads to unblock         */
365:   sem_t semBlockQueue;		/* Queue up threads waiting for the     */
370:   pthread_mutex_t mtxUnblockLock;	/* Mutex that guards access to          */
373:   pthread_cond_t next;		/* Doubly linked list                   */
374:   pthread_cond_t prev;
387:   pthread_mutex_t mtxExclusiveAccess;
388:   pthread_mutex_t mtxSharedAccessCompleted;
389:   pthread_cond_t cndSharedAccessCompleted;
415:    *            (head of chain is key->threads)
451:    *      pthread_setspecific() on a key that has a specified
471:    *              The pthread_t->keys attribute is the head of a
474:    *              between a pthread_t and all pthread_key_t on which
475:    *              it called pthread_setspecific.
480:    *      nextThread
481:    *              The pthread_key_t->threads attribute is the head of
484:    *              relationship between a pthread_key_t and all the 
485:    *              PThreads that have called pthread_setspecific for
486:    *              this pthread_key_t.
488:    *      prevThread
497:    *              pthread_setspecific if the user provided a
503:   pthread_key_t key;
504:   ThreadKeyAssoc *nextKey;
506:   ThreadKeyAssoc *prevKey;
571: /* Declared in pthread_cancel.c */
580: extern pthread_key_t ptw32_selfThreadKey;
581: extern pthread_key_t ptw32_cleanupKey;
582: extern pthread_cond_t ptw32_cond_list_head;
583: extern pthread_cond_t ptw32_cond_list_tail;
587: extern unsigned __int64 ptw32_threadSeqNumber;
601: extern int pthread_count;
617:   int ptw32_is_attr (const pthread_attr_t * attr);
619:   int ptw32_cond_check_need_init (pthread_cond_t * cond);
620:   int ptw32_mutex_check_need_init (pthread_mutex_t * mutex);
621:   int ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock);
622:   int ptw32_spinlock_check_need_init (pthread_spinlock_t * lock);
624:   int ptw32_robust_mutex_inherit(pthread_mutex_t * mutex);
625:   void ptw32_robust_mutex_add(pthread_mutex_t* mutex, pthread_t self);
630: 			       HANDLE threadH, DWORD callback_arg);
636:   void ptw32_threadDestroy (pthread_t tid);
640:   pthread_t ptw32_new (void);
642:   pthread_t ptw32_threadReusePop (void);
657:     ptw32_threadStart (void *vthreadParms);
663:   void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc);
714:   _CRTIMP unsigned long __cdecl _beginthread (void (__cdecl *) (void *),
716:   _CRTIMP void __cdecl _endthread (void);
937: #if defined(NEED_CREATETHREAD)
940:  * Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
950:         CreateThread(security, \
952:                      (LPTHREAD_START_ROUTINE) start_proc, \
959: #endif				/* NEED_CREATETHREAD */
12:  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
20:  *      http://sources.redhat.com/pthreads-win32/contributors.html
131:    * state is greater or equal "PThreadStateRunning".
161:   volatile PThreadState state;
483:    *              nextThreads link. This chain provides the 1 to many
717:   _CRTIMP unsigned long __cdecl _beginthreadex (void *, unsigned,
720:   _CRTIMP void __cdecl _endthreadex (unsigned);
944: #define _beginthreadex(security, \
chromium.googlesource.com/chromium/codesearch:src/native_client_sdk/src/libraries/third_party/pthreads-win32/implement.h: [ master, ] c++ Duplicate result
github.com/google/grumpy:third_party/stdlib/threading.py: [ master, ] python
631: class Thread(_Verbose):
35: _start_new_thread = thread.start_new_thread
1148: current_thread = currentThread
38: ThreadError = thread.error
1071: class _MainThread(Thread):
1096: def _pickSomeNonDaemonThread():
1111: class _DummyThread(Thread):
1135: def currentThread():
1365:     class ProducerThread(Thread):
1381:     class ConsumerThread(Thread):
1: """Thread module emulating a subset of Java's threading model."""
6:     import thread
31:            'current_thread', 'enumerate', 'Event',
32:            'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
36: _allocate_lock = thread.allocate_lock
37: _get_ident = thread.get_ident
39: del thread
67:                 # Issue #4188: calling current_thread() can incur an infinite
73:                     name = "<OS thread %d>" % ident
93:     The func will be passed to sys.setprofile() for each thread, before its
103:     The func will be passed to sys.settrace() for each thread, before its run()
117:     A reentrant lock must be released by the thread that acquired it. Once a
118:     thread has acquired a reentrant lock, the same thread may acquire it again
119:     without blocking; the thread must release it once for each time it has
126:     """A reentrant lock must be released by the thread that acquired it. Once a
127:        thread has acquired a reentrant lock, the same thread may acquire it
128:        again without blocking; the thread must release it once for each time it
150:         When invoked without arguments: if this thread already owns the lock,
152:         if another thread owns the lock, block until the lock is unlocked. Once
153:         the lock is unlocked (not owned by any thread), then grab ownership, set
154:         the recursion level to one, and return. If more than one thread is
191:         by any thread), and if any other threads are blocked waiting for the
194:         locked and owned by the calling thread.
196:         Only call this method when the calling thread owns the lock. A
246:     notified by another thread.
257:        notified by another thread.
301:         # Return True if lock is owned by current_thread.
312:         If the calling thread has not acquired the lock when this method is
317:         variable in another thread, or until the optional timeout occurs. Once
376:         If the calling thread has not acquired the lock when this method is
403:         If the calling thread has not acquired the lock when this method
445:         on entry, block, waiting until some other thread has called release() to
482:         When the counter is zero on entry and another thread is waiting for it
483:         to become larger than zero again, wake up that thread.
528:         When the counter is zero on entry and another thread is waiting for it
529:         to become larger than zero again, wake up that thread.
567:         # private!  called by Thread._reset_internal_locks by _after_fork()
601:         block until another thread calls set() to set the flag to true, or until
617: # Helper to generate new thread names
619: _counter() # Consume 0 so first non-main thread has id 1.
620: def _newname(template="Thread-%d"):
623: # Active thread administration
625: _active = {}    # maps thread id to Thread object
632:     """A class that represents a thread of control.
649:         *name* is the thread name. By default, a unique name is constructed of
650:         the form "Thread-N" where N is a small decimal number.
658:         the base class constructor (Thread.__init__()) before doing anything
659:         else to the thread.
694:         return current_thread().daemon
697:         assert self.__initialized, "Thread.__init__() was not called"
710:         """Start the thread's activity.
712:         It must be called at most once per thread object. It arranges for the
713:         object's run() method to be invoked in a separate thread of control.
716:         same thread object.
720:             raise RuntimeError("thread.__init__() not called")
724:             self._note("%s.start(): starting thread", self)
728:             _start_new_thread(self.__bootstrap, ())
736:         """Method representing the thread's activity.
748:             # Avoid a refcycle if the thread is running a function with
749:             # an argument that has a member that points to the thread.
755:         # happen when a daemon thread wakes up at an unfortunate
783:                 self._note("%s.__bootstrap(): thread started", self)
805:                     print>>_sys.stderr, ("Exception in thread %s:\n%s" %
814:                             "Exception in thread " + self.name +
860:         "Remove current thread from the dict of currently running threads."
862:         # Notes about running with dummy_thread:
864:         # Must take care to not raise an exception if dummy_thread is being
866:         # dummy_threading).  dummy_thread.get_ident() always returns -1 since
867:         # there is only one thread if dummy_thread is being used.  Thus
868:         # len(_active) is always <= 1 here, and any Thread instance created
869:         # overwrites the (if any) thread currently registered in _active.
872:         # gets overwritten the instant an instance of Thread is created; both
873:         # threads return -1 from dummy_thread.get_ident() and thus have the
876:         # it gets a KeyError if another Thread instance was created.
888:                 # could try to acquire the lock again in the same thread, (in
889:                 # current_thread()), and would block.
895:         """Wait until the thread terminates.
897:         This blocks the calling thread until the thread whose join() method is
905:         thread is still alive, the join() call timed out.
908:         block until the thread terminates.
910:         A thread can be join()ed many times.
913:         thread as that would cause a deadlock. It is also an error to join() a
914:         thread before it has been started and attempts to do so raises the same
919:             raise RuntimeError("Thread.__init__() not called")
921:             raise RuntimeError("cannot join thread before it is started")
922:         if self is current_thread():
923:             raise RuntimeError("cannot join current thread")
927:                 self._note("%s.join(): waiting until thread stops", self)
934:                     self._note("%s.join(): thread stopped", self)
946:                         self._note("%s.join(): thread stopped", self)
957:         assert self.__initialized, "Thread.__init__() not called"
961:         assert self.__initialized, "Thread.__init__() not called"
968:         """Thread identifier of this thread or None if it has not been started.
970:         This is a nonzero integer. See the thread.get_ident() function. Thread
971:         identifiers may be recycled when a thread exits and another thread is
972:         created. The identifier is available even after the thread has exited.
975:         assert self.__initialized, "Thread.__init__() not called"
979:         """Return whether the thread is alive.
986:         assert self.__initialized, "Thread.__init__() not called"
992:         """A boolean value indicating whether this thread is a daemon thread (True) or not (False).
995:         raised. Its initial value is inherited from the creating thread; the
996:         main thread is not a daemon thread and therefore all threads created in
997:         the main thread default to daemon = False.
1003:         assert self.__initialized, "Thread.__init__() not called"
1008:             raise RuntimeError("Thread.__init__() not called")
1010:             raise RuntimeError("cannot set daemon status of active thread");
1041: class _Timer(Thread):
1051:         Thread.__init__(self)
1068: # Special thread class to represent the main thread
1074:         Thread.__init__(self, name="MainThread")
1103: # Dummy thread class to represent threads not started here.
1105: # If they invoke anything in threading.py that calls current_thread(), they
1107: # Their purpose is to return *something* from current_thread().
1114:         Thread.__init__(self, name=_newname("Dummy-%d"))
1116:         # Thread.__block consumes an OS-level locking primitive, which
1130:         assert False, "cannot join a dummy thread"
1136:     """Return the current Thread object, corresponding to the caller's thread of control.
1138:     If the caller's thread of control was not created through the threading
1139:     module, a dummy thread object with limited functionality is returned.
1145:         ##print "current_thread(): no current thread for", _get_ident()
1151:     """Return the number of Thread objects currently alive.
1167:     """Return a list of all Thread objects currently alive.
1169:     The list includes daemonic threads, dummy thread objects created by
1170:     current_thread(), and the main thread. It excludes terminated threads and
1177: from thread import stack_size
1179: # Create the main thread object,
1185: # get thread-local implementation, either from the thread
1188: # NOTE: Thread local classes follow: the Grumpy version of this file copies
1196:         key = '_local__key', 'thread.local.' + str(id(self))
1204:         # We need to create the thread dict in anticipation of
1208:         current_thread().__dict__[key] = dict
1214:     d = current_thread().__dict__.get(key)
1217:         current_thread().__dict__[key] = d
1279:         for thread in threads:
1281:                 __dict__ = thread.__dict__
1283:                 # Thread is dying, rest in peace.
1290:                     pass # didn't have anything in this thread
1300:     # by another (non-forked) thread.  http://bugs.python.org/issue874900
1304:     # fork() only copied the current thread; clear references to others.
1306:     current = current_thread()
1308:         for thread in _enumerate():
1311:             if hasattr(thread, '_reset_internal_locks'):
1312:                 thread._reset_internal_locks()
1313:             if thread is current:
1314:                 # There is only one active thread. We reset the ident to
1317:                 thread.__ident = ident
1318:                 new_active[ident] = thread
1321:                 thread.__stop()
1368:             Thread.__init__(self, name="Producer")
1384:             Thread.__init__(self, name="Consumer")
19: #  This threading model was originally inspired by Java, and inherited
29: # Rename some stuff so "from threading import *" is safe
30: __all__ = ['activeCount', 'active_count', 'Condition', 'currentThread',
45:                         module='threading', message='sys.exc_clear')
68:                 # recursion if it has to create a DummyThread on the fly.
91:     """Set a profile function for all threads started from the threading module.
101:     """Set a trace function for all threads started from the threading module.
245:     A condition variable allows one or more threads to wait until they are
256:     """Condition variables allow one or more threads to wait until they are
374:         """Wake up one or more threads waiting on this condition, if any.
379:         This method wakes up at most n of the threads waiting for the condition
380:         variable; it is a no-op if no threads are waiting.
401:         """Wake up all threads waiting on this condition.
449:         which blocked threads are awakened should not be relied on. There is no
579:         All threads waiting for the flag to become true are awakened. Threads
590:         Subsequently, threads calling wait() will block until set() is called to
629: # Main class for threads
643:         *group* should be None; reserved for future extension when a ThreadGroup
683:         if hasattr(self, '__block'):  # DummyThread deletes self.__block
693:         # Overridden in _MainThread and _DummyThread
722:             raise RuntimeError("threads can only be started once")
763:         # reported.  Also, we only suppress them for daemonic threads;
835:                 # test_threading.test_no_refcycle_through_target when
871:         # An instance of _MainThread is always created by 'threading'.  This
874:         # same key in the dict.  So when the _MainThread instance created by
875:         # 'threading' tries to clean itself up when atexit calls this method
879:         # _active if dummy_threading is being used is a red herring.  But
880:         # since it isn't if dummy_threading is *not* being used then don't
891:             if 'dummy_threading' not in _sys.modules:
953:         It has no semantics. Multiple threads may be given the same name. The
983:         returns a list of all alive threads.
999:         The entire Python program exits when no alive non-daemon threads are
1085:         t = _pickSomeNonDaemonThread()
1088:                 self._note("%s: waiting for other threads", self)
1091:             t = _pickSomeNonDaemonThread()
1108: # They are marked as daemon threads so we won't wait for them
1117:         # can never be used by a _DummyThread.  Since a _DummyThread
1146:         return _DummyThread()
1171:     threads that have not yet been started.
1181: # (Py_Main) as threading._shutdown.
1183: _shutdown = _MainThread()._exitfunc
1189: # these from _threading_local.py to avoid circular dependency issues.
1272:             threads = _enumerate()
1274:             # If enumerating the current threads fails, as it seems to do
1292: # END _threading_local.py copy
1296:     # is called from PyOS_AfterFork.  Here we cleanup threading module state
1401:         t = ProducerThread(Q, NI)
1404:     C = ConsumerThread(Q, NI*NP)
850:         # DummyThreads delete self.__block, but they have no waiters to
1295:     # This function is called by Python/ceval.c:PyEval_ReInitThreads which
github.com/html5rocks/slides.html5rocks.com:src/canvasphoto/utilities.js: [ master, ] javascript
333: ...(751 bytes skipped)....subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=1000;this.delay=1;this.registerElement=function(tween){...(197 bytes skipped)...
83: ...(5 bytes skipped)...n id;};return Y.Dom.batch(el,f,Y.Dom,true)||f.apply(Y.Dom,arguments);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}
86: return false;};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){if(isSafari){while(el=el.parentNode){if(...(44 bytes skipped)...
335: return true;};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[0].isAnimated()){this.unRegister(queue[0],0);}}
336: queue=[];thread=null;tweenCount=0;}
github.com/apache/activemq-cpp:activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp: [ master, ] c++
153:             Pointer<Thread> thread;
957:         bool prestartCoreThread() {
1353: ThreadPoolExecutor::ThreadPoolExecutor(int corePoolSize, int maxPoolSize,
1382: ThreadPoolExecutor::ThreadPoolExecutor(int corePoolSize, int maxPoolSize,
1414: ThreadPoolExecutor::ThreadPoolExecutor(int corePoolSize, int maxPoolSize,
1446: ThreadPoolExecutor::ThreadPoolExecutor(int corePoolSize, int maxPoolSize,
1690: bool ThreadPoolExecutor::prestartCoreThread() {
1478: ThreadPoolExecutor::~ThreadPoolExecutor() {
315:         bool coreThreadsCanTimeout;
961:         int prestartAllCoreThreads() {
969:         void allowCoreThreadTimeOut(bool value) {
1614: void ThreadPoolExecutor::setThreadFactory(ThreadFactory* factory) {
1627: ThreadFactory* ThreadPoolExecutor::getThreadFactory() const {
1670: void ThreadPoolExecutor::allowCoreThreadTimeout(bool value) {
1685: bool ThreadPoolExecutor::allowsCoreThreadTimeout() const {
1695: int ThreadPoolExecutor::prestartAllCoreThreads() {
61:      * task deletion logic can remain unchanged and thread safe.
102:      * for example when a ThreadFactory fails to create a thread when
114:      *             the thread transitioning to state TIDYING
168:                 AbstractQueuedSynchronizer(), Runnable(), thread(), firstTask(task), kernel(kernel), completedTasks(0) {
175:                 this->thread.reset(kernel->factory->newThread(this));
210:                     setExclusiveOwnerThread(Thread::currentThread());
226:          * to the Timer's thread.
307:          * up on a separate thread because the Worker generally adds itself to the deadWorkers
422:                     worker->thread->join();
593:                     iter->next()->thread->interrupt();
611:          *      currently waiting.  Interrupting any arbitrary thread ensures that
624:                     Pointer<Thread> thread = worker->thread;
625:                     if (!thread->isInterrupted() && worker->tryLock()) {
627:                             thread->interrupt();
656:          * Ensures that unless the pool is stopping, the current thread does not have
661:             if (this->runStateLessThan(ctl.get(), STOP) && Thread::interrupted() &&
664:                 Thread::currentThread()->interrupt();
690:          * usually leads processWorkerExit to replace this thread.
695:          * stopping, this thread does not have its interrupt set.
698:          * might throw an exception, in which case we cause thread to die
708:          * thread's UncaughtExceptionHandler).  Any thrown exception also
709:          * conservatively causes thread to die.
712:          * also throw an exception, which will also cause thread to
717:          * and the thread's UncaughtExceptionHandler have as accurate
732:                         this->parent->beforeExecute(w->thread.get(), task);
796:              * start a new thread with the given command as its first
802:              * to double-check whether we should have added a thread
806:              * stopped, or start a new thread if there are none.
809:              * thread.  If it fails, we know we are shut down or saturated
1106:          * if the thread factory fails to create a thread when asked, which requires
1111:          *      The task the new thread should run first (or null if none).
1153:             Pointer<Thread> t = w->thread;
1187:             // It is possible (but unlikely) for a thread to have been added to
1189:             // could result in a rare missed interrupt, because Thread::interrupt
1190:             // is not guaranteed to have any effect on a non-yet-started Thread
1191:             // (see Thread#interrupt).
1203:          * thread from worker set, and possibly terminates the pool or replaces the
1329:          * abrupt termination of a thread (see processWorkerExit). Other
1710: void ThreadPoolExecutor::beforeExecute(Thread* thread DECAF_UNUSED, Runnable* task DECAF_UNUSED) {
18: #include "ThreadPoolExecutor.h"
89:      *   workerCount, indicating the effective number of threads
93:      * (2^29)-1 (about 500 million) threads rather than (2^31)-1 (2
101:      * transiently different from the actual number of live threads,
103:      * asked, and when exiting threads are still performing
133:      * Threads waiting in awaitTermination() will return when the
172:                         "ThreadPoolExecutor Worker requires non-NULL pointer to parent ExecutorKernel");
217:                 this->setExclusiveOwnerThread(NULL);
291:         ThreadPoolExecutor* parent;
294:          * List containing all worker threads in pool. Accessed only when holding mainLock.
318:          * The queue used for holding tasks and handing off to worker threads.
333:          * Otherwise exiting threads would concurrently interrupt those that have not
349:         Pointer<ThreadFactory> factory;
354:         ExecutorKernel(ThreadPoolExecutor* parent,
357:                        ThreadFactory* threadFactory, RejectedExecutionHandler* handler) :
381:            if(workQueue == NULL || threadFactory == NULL || handler == NULL) {
389:            this->factory.reset(threadFactory);
417:                 // Ensure dead Worker Threads are destroyed, the Timer might not have
586:          * Force an interrupt of all threads even if they are currently active.
603:          * Interrupts threads that might be waiting for tasks (as indicated by not
610:          *      interrupted to propagate shutdown signals in case all threads are
795:              * 1. If fewer than corePoolSize threads are running, try to
799:              * threads when it shouldn't, by returning false.
932:                 // We don't really know how many new threads are "needed".
972:                     "Core threads must have nonzero keep alive times");
990:                     "Core threads must have nonzero keep alive times");
1113:          *      to bypass queuing when there are fewer than corePoolSize threads
1115:          *      (in which case we must bypass queue). Initially idle threads are
1116:          *      usually created via prestartCoreThread or to replace other dying workers.
1157:                 // Recheck while holding lock. Back out on ThreadFactory failure or if
1201:          * worker threads. Unless completedAbruptly is set, assumes that workerCount
1365:         Pointer<RejectedExecutionHandler> handler(new ThreadPoolExecutor::AbortPolicy());
1366:         Pointer<ThreadFactory> threadFactory(Executors::getDefaultThreadFactory());
1370:             threadFactory.get(), handler.get());
1373:         threadFactory.release();
1399:         Pointer<ThreadFactory> threadFactory(Executors::getDefaultThreadFactory());
1403:             threadFactory.get(), handler);
1405:         threadFactory.release();
1417:                                        ThreadFactory* threadFactory) :
1427:         if(threadFactory == NULL) {
1428:             throw NullPointerException(__FILE__, __LINE__, "The ThreadFactory pointer cannot be NULL.");
1431:         Pointer<RejectedExecutionHandler> handler(new ThreadPoolExecutor::AbortPolicy());
1435:             threadFactory, handler.get());
1449:                                        ThreadFactory* threadFactory, RejectedExecutionHandler* handler) :
1463:         if(threadFactory == NULL) {
1464:             throw NullPointerException(__FILE__, __LINE__, "The ThreadFactory pointer cannot be NULL.");
1469:             threadFactory, handler);
1488: void ThreadPoolExecutor::execute(Runnable* task) {
1495:                 "ThreadPoolExecutor::execute - Supplied Runnable pointer was NULL.");
1507: void ThreadPoolExecutor::execute(Runnable* task, bool takeOwnership) {
1514:                 "ThreadPoolExecutor::execute - Supplied Runnable pointer was NULL.");
1526: void ThreadPoolExecutor::shutdown() {
1536: ArrayList<Runnable*> ThreadPoolExecutor::shutdownNow() {
1549: bool ThreadPoolExecutor::awaitTermination(long long timeout, const TimeUnit& unit) {
1559: int ThreadPoolExecutor::getPoolSize() const {
1564: int ThreadPoolExecutor::getCorePoolSize() const {
1569: void ThreadPoolExecutor::setCorePoolSize(int poolSize) {
1579: int ThreadPoolExecutor::getMaximumPoolSize() const {
1584: void ThreadPoolExecutor::setMaximumPoolSize(int maxSize) {
1594: long long ThreadPoolExecutor::getTaskCount() const {
1599: int ThreadPoolExecutor::getActiveCount() const {
1604: long long ThreadPoolExecutor::getCompletedTaskCount() const {
1609: int ThreadPoolExecutor::getLargestPoolSize() const {
1617:         throw NullPointerException(__FILE__, __LINE__, "Cannot assign a NULL ThreadFactory.");
1621:         Pointer<ThreadFactory> temp(factory);
1632: RejectedExecutionHandler* ThreadPoolExecutor::getRejectedExecutionHandler() const {
1637: void ThreadPoolExecutor::setRejectedExecutionHandler(RejectedExecutionHandler* handler) {
1650: BlockingQueue<Runnable*>* ThreadPoolExecutor::getQueue() {
1655: bool ThreadPoolExecutor::isShutdown() const {
1660: bool ThreadPoolExecutor::isTerminated() const {
1665: bool ThreadPoolExecutor::isTerminating() const {
1675: long long ThreadPoolExecutor::getKeepAliveTime(const TimeUnit& unit) const {
1680: void ThreadPoolExecutor::setKeepAliveTime(long long timeout, const TimeUnit& unit) {
1691:     return this->kernel->prestartCoreThread();
1700: bool ThreadPoolExecutor::remove(decaf::lang::Runnable* task) {
1705: void ThreadPoolExecutor::purge() {
1714: void ThreadPoolExecutor::afterExecute(Runnable* task DECAF_UNUSED, decaf::lang::Throwable* error DECAF_UNUSED) ...(1 bytes skipped)...
1718: void ThreadPoolExecutor::terminated() {
1722: void ThreadPoolExecutor::onShutdown() {
366:            coreThreadsCanTimeout(false),
540:          * allow access from ScheduledThreadPoolExecutor.
669:          * State check needed by ScheduledThreadPoolExecutor to enable running
975:             if (value != this->coreThreadsCanTimeout) {
976:                 this->coreThreadsCanTimeout = value;
988:             if (time == 0 && this->coreThreadsCanTimeout) {
1232:                     int min = this->coreThreadsCanTimeout ? 0 : corePoolSize;
1254:          *     {@code allowCoreThreadTimeOut || workerCount > corePoolSize})
1277:                     timed = this->coreThreadsCanTimeout || wc > this->corePoolSize;
1671:     this->kernel->allowCoreThreadTimeOut(value);
1686:     return this->kernel->coreThreadsCanTimeout;
1696:     return this->kernel->prestartAllCoreThreads();
android.googlesource.com/platform/external/vulkan-validation-layers:layers/threading.h: [ master, ] c++
44:     loader_platform_thread_id thread;
22: #define THREADING_H
37: enum THREADING_CHECKER_ERROR {
38:     THREADING_CHECKER_NONE,                 // Used for INFO & other non-error messages
39:     THREADING_CHECKER_MULTIPLE_THREADS,     // Object used simultaneously by multiple threads
40:     THREADING_CHECKER_SINGLE_THREAD_REUSE,  // Object used simultaneously by recursion in single thread
51: namespace threading {
55: inline bool startMultiThread() {
68: inline void finishMultiThread() { vulkan_in_use = false; }
53: volatile bool vulkan_multi_threaded = false;
84:         loader_platform_thread_id tid = loader_platform_get_thread_id();
87:             // There is no current use of the object.  Record writer thread.
91:             use_data->thread = tid;
96:                 if (use_data->thread != tid) {
100:                                         "thread 0x%" PRIx64 " and thread 0x%" PRIx64,
101:                                         typeName, (uint64_t)use_data->thread, (uint64_t)tid);
103:                         // Wait for thread-safe access to object instead of skipping call.
107:                         // There is now no current use of the object.  Record writer thread.
109:                         new_use_data->thread = tid;
114:                         use_data->thread = tid;
124:                 if (use_data->thread != tid) {
128:                                         "thread 0x%" PRIx64 " and thread 0x%" PRIx64,
129:                                         typeName, (uint64_t)use_data->thread, (uint64_t)tid);
131:                         // Wait for thread-safe access to object instead of skipping call.
135:                         // There is now no current use of the object.  Record writer thread.
137:                         new_use_data->thread = tid;
142:                         use_data->thread = tid;
174:         loader_platform_thread_id tid = loader_platform_get_thread_id();
181:             use_data->thread = tid;
182:         } else if (uses[object].writer_count > 0 && uses[object].thread != tid) {
187:                                 "thread 0x%" PRIx64 " and thread 0x%" PRIx64,
188:                                 typeName, (uint64_t)uses[object].thread, (uint64_t)tid);
190:                 // Wait for thread-safe access to object instead of skipping call.
198:                 use_data->thread = tid;
21: #ifndef THREADING_H
54: // starting check if an application is using vulkan from multiple threads.
56:     if (vulkan_multi_threaded) {
60:         vulkan_multi_threaded = true;
67: // finishing check if an application is using vulkan from multiple threads.
69: }  // namespace threading
98:                                         THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
99:                                         "THREADING ERROR : object of type %s is simultaneously used in "
126:                                         THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
127:                                         "THREADING ERROR : object of type %s is simultaneously used in "
164:         // Notify any waiting threads that this object may be safe to use
185:                                 THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
186:                                 "THREADING ERROR : object of type %s is simultaneously used in "
216:         // Notify any waiting threads that this object may be safe to use
409: #endif  // THREADING_H
github.com/rosjava/rosjava_core:apache_xmlrpc_common/src/main/java/org/apache/xmlrpc/util/ThreadPool.java: [ kinetic, ] java
50:         private Thread thread;
28: public class ThreadPool {
111: 	private final ThreadGroup threadGroup;
123: 	public ThreadPool(int pMaxSize, String pName) {
113: 	private final List waitingThreads = new ArrayList();
114: 	private final List runningThreads = new ArrayList();
226: 	public int getMaxThreads() { return maxSize; }
231:     public synchronized int getNumThreads() { return num; }
25: /** Simple thread pool. A task is executed by obtaining a thread from
29: 	/** The thread pool contains instances of {@link ThreadPool.Task}.
33: 		 * @throws Throwable The task failed, and the worker thread won't be used again.
52:             thread = new Thread(pGroup, pGroup.getName() + "-" + pNum){
80:             thread.start();
93:             synchronized (thread) {
94:                 thread.notify();
105:             synchronized (thread) {
106:                 thread.notify();
121: 	 * @param pName Thread group name.
51:         Poolable(ThreadGroup pGroup, int pNum) {
120: 	 * @param pMaxSize Maximum number of concurrent threads.
125: 		threadGroup = new ThreadGroup(pName);
167: 	 * might consider to use the {@link #addTask(ThreadPool.Task)} method instead.
189:             poolable = new Poolable(threadGroup, num++);
223: 	/** Returns the maximum number of concurrent threads.
224: 	 * @return Maximum number of threads.
228: 	/** Returns the number of threads, which have actually been created,
229:      * as opposed to the number of currently running threads.
129:         runningThreads.remove(pPoolable);
130:         waitingThreads.remove(pPoolable);
138: 	        if (runningThreads.remove(pPoolable)) {
139: 	            if (maxSize != 0  &&  runningThreads.size() + waitingThreads.size() >= maxSize) {
142: 	                waitingThreads.add(pPoolable);
179:         if (maxSize != 0  &&  runningThreads.size() >= maxSize) {
186:         if (waitingThreads.size() > 0) {
187:             poolable = (Poolable) waitingThreads.remove(waitingThreads.size()-1);
191:         runningThreads.add(poolable);
213:         while (!waitingThreads.isEmpty()) {
214:             Poolable poolable = (Poolable) waitingThreads.remove(waitingThreads.size()-1);
217:         while (!runningThreads.isEmpty()) {
218:             Poolable poolable = (Poolable) runningThreads.remove(runningThreads.size()-1);
github.com/googlesamples/vulkan-basic-samples:layers/threading.h: [ master, ] c++
44:     loader_platform_thread_id thread;
22: #define THREADING_H
37: enum THREADING_CHECKER_ERROR {
38:     THREADING_CHECKER_NONE,                 // Used for INFO & other non-error messages
39:     THREADING_CHECKER_MULTIPLE_THREADS,     // Object used simultaneously by multiple threads
40:     THREADING_CHECKER_SINGLE_THREAD_REUSE,  // Object used simultaneously by recursion in single thread
51: namespace threading {
55: inline bool startMultiThread() {
68: inline void finishMultiThread() { vulkan_in_use = false; }
53: volatile bool vulkan_multi_threaded = false;
84:         loader_platform_thread_id tid = loader_platform_get_thread_id();
87:             // There is no current use of the object.  Record writer thread.
91:             use_data->thread = tid;
96:                 if (use_data->thread != tid) {
99:                                         "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld",
100:                                         typeName, use_data->thread, tid);
102:                         // Wait for thread-safe access to object instead of skipping call.
106:                         // There is now no current use of the object.  Record writer thread.
108:                         new_use_data->thread = tid;
113:                         use_data->thread = tid;
123:                 if (use_data->thread != tid) {
126:                                         "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld",
127:                                         typeName, use_data->thread, tid);
129:                         // Wait for thread-safe access to object instead of skipping call.
133:                         // There is now no current use of the object.  Record writer thread.
135:                         new_use_data->thread = tid;
140:                         use_data->thread = tid;
172:         loader_platform_thread_id tid = loader_platform_get_thread_id();
179:             use_data->thread = tid;
180:         } else if (uses[object].writer_count > 0 && uses[object].thread != tid) {
184:                                 "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld", typeName,
185:                                 uses[object].thread, tid);
187:                 // Wait for thread-safe access to object instead of skipping call.
195:                 use_data->thread = tid;
21: #ifndef THREADING_H
54: // starting check if an application is using vulkan from multiple threads.
56:     if (vulkan_multi_threaded) {
60:         vulkan_multi_threaded = true;
67: // finishing check if an application is using vulkan from multiple threads.
69: }  // namespace threading
98:                                         THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
125:                                         THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
162:         // Notify any waiting threads that this object may be safe to use
183:                                 THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
213:         // Notify any waiting threads that this object may be safe to use
399: #endif  // THREADING_H
github.com/apache/logging-log4cxx:src/main/cpp/threadcxx.cpp: [ master, ] c++
84:                             Thread* thread;
140: Thread::Thread() : thread(NULL), alive(0), interruptedStatus(0), 
144: Thread::~Thread() {
63:                             Thread* getThread() const {
238: bool Thread::isCurrentThread() const {
120: 			ThreadLocal& getThreadLocal() {
208: void Thread::currentThreadInterrupt() {
19: #include <log4cxx/helpers/thread.h>
21: #include <apr_thread_proc.h>
26: #include <apr_thread_cond.h>
35:                          *   Thread::run when they are passed to Thread::launcher.
44:                              *  before thread is launched.
57: 			    LaunchPackage(Thread* t, Runnable r, void* d) : thread(t), runnable(r), data(d) {
60:                              * Gets thread parameter.
61:                              * @return thread.
64: 				  return thread;
76:                              *  @return thread.
92:                          *  Used to maintain Thread.alive.
117:                          *   Get a key to the thread local storage used to hold the reference to
118:                          *   the corresponding Thread object.
127: void* LOG4CXX_THREAD_FUNC ThreadLaunch::launcher(apr_thread_t* thread, void* data) {
132:       (package->getRunnable())(thread, package->getData());
135:     apr_thread_exit(thread, 0); // this function never returns !
150: void Thread::run(Runnable start, void* data) {
156:         // now we're ready to create the thread again
158:         //    if attempting a second run method on the same Thread object
161:         if (thread != NULL) {
170:        stat = apr_thread_cond_create(&interruptedCondition, p.getAPRPool());
174:        stat = apr_thread_mutex_create(&interruptedMutex, APR_THREAD_MUTEX_NESTED, 
180:         //   create LaunchPackage on the thread's memory pool
182:         stat = apr_thread_create(&thread, attrs,
188:         // if run() has been called in a thread-safe way.
195: void Thread::join() {
197:     if (thread != NULL) {
199:         apr_status_t stat = apr_thread_join(&startStat, thread);
200:         thread = NULL;
212:        ((Thread*) tls)->interrupt();
217: void Thread::interrupt() {
222:         apr_status_t stat = apr_thread_cond_signal(interruptedCondition);
228: bool Thread::interrupted() {
232:        return apr_atomic_xchg32(&(((Thread*) tls)->interruptedStatus), 0) != 0;
247: bool Thread::isAlive() {
251: void Thread::ending() {
256: void Thread::sleep(int duration) {
262:         Thread* pThis = (Thread*) getThreadLocal().get();
267:             apr_status_t stat = apr_thread_cond_timedwait(pThis->interruptedCondition, 
24: #include <log4cxx/helpers/threadlocal.h>
31: #if APR_HAS_THREADS
121:      				static ThreadLocal tls;
129: 	ThreadLocal& tls = getThreadLocal();
130: 	tls.set(package->getThread());
133:       package->getThread()->ending();
151: #if APR_HAS_THREADS
164:         apr_threadattr_t* attrs;
165:         apr_status_t stat = apr_threadattr_create(&attrs, p.getAPRPool());
167:                 throw ThreadException(stat);
172:             throw ThreadException(stat);
177:             throw ThreadException(stat);
183:             ThreadLaunch::launcher, package, p.getAPRPool());
185:                 throw ThreadException(stat);
191:         throw ThreadException(LOG4CXX_STR("APR_HAS_THREADS is not true"));
196: #if APR_HAS_THREADS
202:             throw ThreadException(stat);
209: #if APR_HAS_THREADS
219: #if APR_HAS_THREADS
223:         if (stat != APR_SUCCESS) throw ThreadException(stat);
229: #if APR_HAS_THREADS
239: #if APR_HAS_THREADS
257: #if APR_HAS_THREADS
270:                 throw ThreadException(stat);
210:    void* tls = getThreadLocal().get();
230:    void* tls = getThreadLocal().get();
240:     const void* tls = getThreadLocal().get();
github.com/googlegsa/sharepoint.v3:projects/ApacheHttpClient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java: [ master, ] java
1046:         public Thread thread;
93:     private static ReferenceQueueThread REFERENCE_QUEUE_THREAD;
917:         public synchronized void notifyWaitingThread(HostConfiguration configuration) {
928:         public synchronized void notifyWaitingThread(HostConnectionPool hostPool) {
1044:     private static class WaitingThread {
1061:     private static class ReferenceQueueThread extends Thread {
1068:         public ReferenceQueueThread() {
65: public class MultiThreadedHttpConnectionManager implements HttpConnectionManager {
256:     public MultiThreadedHttpConnectionManager() {
706:         private LinkedList waitingThreads = new LinkedList();
1034:         public LinkedList waitingThreads = new LinkedList();
91:      * The thread responsible for handling lost connections.
134:             if (REFERENCE_QUEUE_THREAD != null) {
135:                 REFERENCE_QUEUE_THREAD.shutdown();
136:                 REFERENCE_QUEUE_THREAD = null;
171:             // start the reference queue thread if needed
172:             if (REFERENCE_QUEUE_THREAD == null) {
173:                 REFERENCE_QUEUE_THREAD = new ReferenceQueueThread();
174:                 REFERENCE_QUEUE_THREAD.start();
507:                             waitingThread.thread = Thread.currentThread();
531:                             // interrupted by an external thread.  Regardless we need to 
624:      * If another thread is blocked in getConnection() that could use this
741:                 waiter.thread.interrupt();
912:          * Notifies a waiting thread that a connection for the given configuration is 
922:          * Notifies a waiting thread that a connection for the given configuration is 
923:          * available.  This will wake a thread waiting in this host pool or if there is not
924:          * one a thread in the connection pool will be notified.
930:             // find the thread we are going to notify, we want to ensure that each
931:             // waiting thread is only interrupted once so we will remove it from 
937:                     LOG.debug("Notifying thread waiting on host pool, hostConfig=" 
944:                     LOG.debug("No-one waiting on host pool, notifying next waiting thread.");
954:                 waitingThread.thread.interrupt();
1041:      * A simple struct-like class to combine the waiting thread and the connection 
1045:         /** The thread that is waiting for a connection */
1048:         /** The connection pool the thread is waiting for */
1051:         /** Flag to indicate if the thread was interrupted by the ConnectionPool. Set
1053:          * before the thread is interrupted. */
1058:      * A thread for listening for HttpConnections reclaimed by the garbage
1066:          * Create an instance and make this a daemon thread.
105:      * MultiThreadedHttpConnectionManager. All static resources are released, all threads are 
453:             WaitingThread waitingThread = null;
492:                     // threads, so they avoid being sacrificed before necessary
504:                         if (waitingThread == null) {
505:                             waitingThread = new WaitingThread();
506:                             waitingThread.hostConnectionPool = hostPool;
509:                             waitingThread.interruptedByConnectionPool = false;
516:                         hostPool.waitingThreads.addLast(waitingThread);
517:                         connectionPool.waitingThreads.addLast(waitingThread);
520:                         if (!waitingThread.interruptedByConnectionPool) {
529:                         if (!waitingThread.interruptedByConnectionPool) {
533:                             hostPool.waitingThreads.remove(waitingThread);
534:                             connectionPool.waitingThreads.remove(waitingThread);
735:             // interrupt all waiting threads
738:                 WaitingThread waiter = (WaitingThread) iter.next();
777:          * connection counts and notifies waiting threads, if appropriate.
787:             notifyWaitingThread(config);
915:          * @see #notifyWaitingThread(HostConnectionPool)
918:             notifyWaitingThread(getHostPool(configuration));
933:             WaitingThread waitingThread = null;
940:                 waitingThread = (WaitingThread) hostPool.waitingThreads.removeFirst();
941:                 waitingThreads.remove(waitingThread);
946:                 waitingThread = (WaitingThread) waitingThreads.removeFirst();
947:                 waitingThread.hostConnectionPool.waitingThreads.remove(waitingThread);
949:                 LOG.debug("Notifying no-one, there are no waiting threads");
952:             if (waitingThread != null) {
953:                 waitingThread.interruptedByConnectionPool = true;
1004:                 notifyWaitingThread(hostPool);
1052:          * to true inside {@link ConnectionPool#notifyWaitingThread(HostConnectionPool)} 
1115:                     LOG.debug("ReferenceQueueThread interrupted", e);
2: ...(43 bytes skipped)...ommons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java,v 1.47 2004/12/21 11:27:55 olegk Exp $
70:     private static final Log LOG = LogFactory.getLog(MultiThreadedHttpConnectionManager.class);
107:      * MultiThreadedHttpConnectionManager.
118:                 MultiThreadedHttpConnectionManager[]
119:                     connManagers = (MultiThreadedHttpConnectionManager[])
121:                         new MultiThreadedHttpConnectionManager
522:                             throw new IllegalThreadStateException(
523:                                 "Interrupted while waiting in MultiThreadedHttpConnectionManager");
705:         /** The list of WaitingThreads waiting for a connection */
736:             iter = waitingThreads.iterator();
764:             connection.getParams().setDefaults(MultiThreadedHttpConnectionManager.this.params);
765:             connection.setHttpConnectionManager(MultiThreadedHttpConnectionManager.this);
935:             if (hostPool.waitingThreads.size() > 0) {
942:             } else if (waitingThreads.size() > 0) {
1033:         /** The list of WaitingThreads for this host */
1070:             setName("MultiThreadedHttpConnectionManager cleanup");
github.com/apache/polygene-sandbox:libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceMixin.java: [ master, ] java
105:         private final Thread thread;
18: package org.qi4j.library.thread;
33:     @Service private ThreadGroupService threadGroupService;
35:     private int threadCount;
43:     public Thread newThread( Runnable runnable )
78:     private void createNewThread()
103:     public static class RunnableThread
108:         public RunnableThread( Thread thread, PooledRunnableWrapper runnable )
28: public class PooledThreadServiceMixin
37:     public PooledThreadServiceMixin()
58:             return rt.thread;
85:         Thread t = new Thread( group, runnable, name );
95:         for( RunnableThread thread : pool )
98:             thread.runnable.run = false;
99:             thread.thread.interrupt();
110:             this.thread = thread;
29:     implements ThreadService, Activatable
31:     @This private Configuration<ThreadServiceConfiguration> config;
34:     private LinkedList<RunnableThread> pool;
39:         pool = new LinkedList<RunnableThread>();
40:         threadCount = 0;
50:                 if( threadCount >= max )
54:                 createNewThread();
56:             RunnableThread rt = pool.removeFirst();
62:     public ThreadServiceConfiguration configuration()
70:         pool = new LinkedList<RunnableThread>();
74:             createNewThread();
80:         ThreadServiceConfiguration configuration = config.configuration();
81:         String tgName = configuration.threadGroupName().get();
82:         ThreadGroup group = threadGroupService.getThreadGroup( tgName );
83:         String name = configuration.threadBaseName().get() + "-" + sequence.newSequenceValue();
86:         RunnableThread runnableThread = new RunnableThread( t, runnable );
87:         runnable.poolInstance = runnableThread;
88:         threadCount++;
89:         pool.add( runnableThread );
97:             threadCount = 0;
120:         private RunnableThread poolInstance;
49:                 Integer max = config.configuration().maxThreads().get();
52:                     throw new MaximumThreadsException( max );
71:         int prefered = config.configuration().preferedNumberOfThreads().get();
github.com/googlecreativelab/chrome-music-lab:harmonics & strings/js/Thread.js: [ master, ] javascript
5: var Thread = function(xp0Pm, yp0Pm, xp1Pm, yp1Pm, indPm, indHarmonicPm, isTopPm, threadControllerPm) {
1: // class:	Thread
52: 	// how close do we have to be to instantly grab a thread - perpendicular distance (px)
60: 	// total length of this thread (when unstretched)
131: Thread.prototype.init = function() {
140: Thread.prototype.redraw = function() {
185: Thread.prototype.upd = function() {
186: 	// is thread currently grabbed
189: 	// is thread currently oscillating
198: Thread.prototype.updOsc = function() {
248: Thread.prototype.updGrab = function() {
250: 	// is this thread being held by a fish?
291: Thread.prototype.stopNote = function() {
298: Thread.prototype.pluck = function(xp, yp, byUser, fish) {
366: Thread.prototype.grab = function(xp, yp, byUser, car) {
386: Thread.prototype.drop = function() {
416: Thread.prototype.startOsc = function() {
430: Thread.prototype.playNote = function(vol, pan) {
445: Thread.prototype.setStretch = function(r) {
452: // desc:      Check when user first clicks if they clicked right on top of a thread,
455: Thread.prototype.checkInstantGrab = function() {
479: // desc:      Check when user first clicks if they clicked right on top of a thread,
482: Thread.prototype.setPosition = function(x0, y0, x1, y1) {
6: 	this.m = threadControllerPm;
67: 	// my overall index number of all threads
278: 		this.m.dropThread(this);
474: 		this.m.grabThread(this, xu, yu, true, null);
github.com/google/skylark:eval.go: [ master, ] go
29: type Thread struct {
26: // A Thread contains the state of a Skylark thread,
27: // such as its call stack and thread-local storage.
28: // The Thread is threaded throughout the evaluator.
36: 	Print func(thread *Thread, msg string)
44: 	Load func(thread *Thread, module string) (StringDict, error)
46: 	// locals holds arbitrary "thread-local" Go values belonging to the client.
51: // SetLocal sets the thread-local value associated with the specified key.
53: func (thread *Thread) SetLocal(key string, value interface{}) {
54: 	if thread.locals == nil {
55: 		thread.locals = make(map[string]interface{})
57: 	thread.locals[key] = value
60: // Local returns the thread-local value associated with the specified key.
61: func (thread *Thread) Local(key string) interface{} {
62: 	return thread.locals[key]
67: func (thread *Thread) Caller() *Frame {
68: 	return thread.frame
207: // Thread is the state associated with the Skylark thread.
221: func ExecFile(thread *Thread, filename string, src interface{}, predeclared StringDict) (StringDict, error) {
228: 	g, err := mod.Init(thread, predeclared)
270: func (prog *Program) Init(thread *Thread, predeclared StringDict) (StringDict, error) {
273: 	_, err := toplevel.Call(thread, nil, nil)
318: func Eval(thread *Thread, filename string, src interface{}, env StringDict) (Value, error) {
331: 	return fn.Call(thread, nil, nil)
710: 			needle, ok := x.(String)
714: 			return Bool(strings.Contains(string(y), string(needle))), nil
794: func Call(thread *Thread, fn Value, args Tuple, kwargs []Tuple) (Value, error) {
799: 	res, err := c.Call(thread, args, kwargs)
github.com/fuchsia-mirror/third_party-vulkan_loader_and_validation_layers:layers/threading.h: [ master, ] c++
44:     loader_platform_thread_id thread;
22: #define THREADING_H
37: enum THREADING_CHECKER_ERROR {
38:     THREADING_CHECKER_NONE,                 // Used for INFO & other non-error messages
39:     THREADING_CHECKER_MULTIPLE_THREADS,     // Object used simultaneously by multiple threads
40:     THREADING_CHECKER_SINGLE_THREAD_REUSE,  // Object used simultaneously by recursion in single thread
51: namespace threading {
55: inline bool startMultiThread() {
68: inline void finishMultiThread() { vulkan_in_use = false; }
53: volatile bool vulkan_multi_threaded = false;
84:         loader_platform_thread_id tid = loader_platform_get_thread_id();
87:             // There is no current use of the object.  Record writer thread.
91:             use_data->thread = tid;
96:                 if (use_data->thread != tid) {
99:                                         "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld",
100:                                         typeName, use_data->thread, tid);
102:                         // Wait for thread-safe access to object instead of skipping call.
106:                         // There is now no current use of the object.  Record writer thread.
108:                         new_use_data->thread = tid;
113:                         use_data->thread = tid;
123:                 if (use_data->thread != tid) {
126:                                         "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld",
127:                                         typeName, use_data->thread, tid);
129:                         // Wait for thread-safe access to object instead of skipping call.
133:                         // There is now no current use of the object.  Record writer thread.
135:                         new_use_data->thread = tid;
140:                         use_data->thread = tid;
172:         loader_platform_thread_id tid = loader_platform_get_thread_id();
179:             use_data->thread = tid;
180:         } else if (uses[object].writer_count > 0 && uses[object].thread != tid) {
184:                                 "THREADING ERROR : object of type %s is simultaneously used in thread %ld and thread %ld", typeName,
185:                                 uses[object].thread, tid);
187:                 // Wait for thread-safe access to object instead of skipping call.
195:                 use_data->thread = tid;
21: #ifndef THREADING_H
54: // starting check if an application is using vulkan from multiple threads.
56:     if (vulkan_multi_threaded) {
60:         vulkan_multi_threaded = true;
67: // finishing check if an application is using vulkan from multiple threads.
69: }  // namespace threading
98:                                         THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
125:                                         THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
162:         // Notify any waiting threads that this object may be safe to use
183:                                 THREADING_CHECKER_MULTIPLE_THREADS, "THREADING",
213:         // Notify any waiting threads that this object may be safe to use
404: #endif  // THREADING_H
github.com/google/neper:thread.h: [ master, ] c++
26: struct thread {
18: #define NEPER_THREAD_H
17: #ifndef NEPER_THREAD_H
43: int run_main_thread(struct options *opts, struct callbacks *cb,
44:                     void *(*thread_func)(void *),
45:                     void (*report_stats)(struct thread *));
20: #include <pthread.h>
28:         pthread_t id;
37:         pthread_barrier_t *ready;
39:         pthread_mutex_t *time_start_mutex;
android.googlesource.com/platform/system/nfc:src/adaptation/NfcAdaptation.cc: [ master, ] c++
408: uint32_t NfcAdaptation::Thread(__attribute__((unused)) uint32_t arg) {
762: ThreadMutex::ThreadMutex() {
812: ThreadCondVar::ThreadCondVar() {
779: ThreadMutex::~ThreadMutex() { pthread_mutex_destroy(&mMutex); }
830: ThreadCondVar::~ThreadCondVar() { pthread_cond_destroy(&mCondVar); }
869: AutoThreadMutex::AutoThreadMutex(ThreadMutex& m) : mm(m) { mm.lock(); }
880: AutoThreadMutex::~AutoThreadMutex() { mm.unlock(); }
236:   // Android already logs thread_id, proc_id, timestamp, so disable those.
317:     GKI_create_task((TASKPTR)Thread, MMI_TASK, (int8_t*)"NFCA_THREAD", 0, 0,
375: ** Description: signal the CondVar to release the thread that is waiting
401: ** Function:    NfcAdaptation::Thread()
409:   const char* func = "NfcAdaptation::Thread";
55: ThreadMutex NfcAdaptation::sLock;
58: ThreadCondVar NfcAdaptation::mHalOpenCompletedEvent;
59: ThreadCondVar NfcAdaptation::mHalCloseCompletedEvent;
250:     // of a byte array is ambiguous and needlessly difficult to configure.
314:                   (pthread_cond_t*)NULL, NULL);
318:                     (pthread_cond_t*)NULL, NULL);
403: ** Description: Creates work threads
413:     ThreadCondVar CondVar;
416:                     (pthread_cond_t*)CondVar, (pthread_mutex_t*)CondVar);
755: ** Function:    ThreadMutex::ThreadMutex()
763:   pthread_mutexattr_t mutexAttr;
765:   pthread_mutexattr_init(&mutexAttr);
766:   pthread_mutex_init(&mMutex, &mutexAttr);
767:   pthread_mutexattr_destroy(&mutexAttr);
772: ** Function:    ThreadMutex::~ThreadMutex()
783: ** Function:    ThreadMutex::lock()
790: void ThreadMutex::lock() { pthread_mutex_lock(&mMutex); }
794: ** Function:    ThreadMutex::unblock()
801: void ThreadMutex::unlock() { pthread_mutex_unlock(&mMutex); }
805: ** Function:    ThreadCondVar::ThreadCondVar()
813:   pthread_condattr_t CondAttr;
815:   pthread_condattr_init(&CondAttr);
816:   pthread_cond_init(&mCondVar, &CondAttr);
818:   pthread_condattr_destroy(&CondAttr);
823: ** Function:    ThreadCondVar::~ThreadCondVar()
834: ** Function:    ThreadCondVar::wait()
841: void ThreadCondVar::wait() {
842:   pthread_cond_wait(&mCondVar, *this);
843:   pthread_mutex_unlock(*this);
848: ** Function:    ThreadCondVar::signal()
855: void ThreadCondVar::signal() {
857:   pthread_cond_signal(&mCondVar);
164:   AutoThreadMutex a(sLock);
316:     AutoThreadMutex guard(mCondVar);
337:   AutoThreadMutex a(sLock);
414:     AutoThreadMutex guard(CondVar);
856:   AutoThreadMutex a(*this);
862: ** Function:    AutoThreadMutex::AutoThreadMutex()
873: ** Function:    AutoThreadMutex::~AutoThreadMutex()
github.com/apache/commons-io:src/main/java/org/apache/commons/io/ThreadMonitor.java: [ master, ] java
42:     private final Thread thread;
40: class ThreadMonitor implements Runnable {
94:     private ThreadMonitor(final Thread thread, final long timeout) {
20:  * Monitors a thread, interrupting it if it reaches the specified timeout.
23:  * interrupting the thread being monitored. If the thread being monitored
25:  * the <i>monitor</i> thread.
31:  *           Thread monitor = ThreadMonitor.start(timeoutInMillis);
46:      * Start monitoring the current thread.
50:      * @return The monitor thread or {@code null}
53:     public static Thread start(final long timeout) {
54:         return start(Thread.currentThread(), timeout);
58:      * Start monitoring the specified thread.
60:      * @param thread The thread The thread to monitor
63:      * @return The monitor thread or {@code null}
66:     public static Thread start(final Thread thread, final long timeout) {
67:         Thread monitor = null;
69:             final ThreadMonitor timout = new ThreadMonitor(thread, timeout);
70:             monitor = new Thread(timout, ThreadMonitor.class.getSimpleName());
78:      * Stop monitoring the specified thread.
80:      * @param thread The monitor thread, may be {@code null}
82:     public static void stop(final Thread thread) {
83:         if (thread != null) {
84:             thread.interrupt();
91:      * @param thread The thread to monitor
95:         this.thread = thread;
101:      * interrupt the thread being monitored.
109:             thread.interrupt();
118:      * This method exists because Thread.sleep(100) can sleep for 0, 70, 100 or 200ms or anything else
119:      * it deems appropriate. Read the docs on Thread.sleep for further interesting details.
128:             Thread.sleep(remaining);
33:  *           ThreadMonitor.stop(monitor);
github.com/fuchsia-mirror/third_party-re2:re2/nfa.cc: [ master, ] c++
64:   struct Thread {
88:   typedef SparseArray<Thread*> Threadq;
165: NFA::Thread* NFA::AllocThread() {
129:   Thread* free_threads_;  // free list
206: void NFA::AddToThreadq(Threadq* q, int id0, int c, int flag,
67:       Thread* next;  // when on free list
75:     Thread* t;  // if not null, set t0 = t before processing id
81:     AddState(int id, Thread* t)
90:   inline Thread* AllocThread();
91:   inline Thread* Incref(Thread* t);
92:   inline void Decref(Thread* t);
97:   // p is the current input position, and t0 is the current thread.
99:                     const char* p, Thread* t0);
157:   Thread* next;
158:   for (Thread* t = free_threads_; t; t = next) {
166:   Thread* t = free_threads_;
168:     t = new Thread;
178: NFA::Thread* NFA::Incref(Thread* t) {
184: void NFA::Decref(Thread* t) {
205: // p is the current input position, and t0 is the current thread.
207:                        const char* p, Thread* t0) {
228:       // t0 was a thread that we allocated and copied in order to
248:     Thread** tp = &q->find(id)->second;
250:     Thread* t;
338:     Thread* t = i->second;
435: // Returns whether haystack contains needle's memory.
436: static bool StringPieceContains(const StringPiece haystack, const StringPiece needle) {
437:   return haystack.begin() <= needle.begin() &&
438:          haystack.end() >= needle.end();
548:         Thread* t = i->second;
599:     // Start a new thread if there have not been any matches.
600:     // (No point in starting a new thread if there have been
620:       Thread* t = AllocThread();
85:   // Threadq is a list of threads.  The list is sorted by the order
98:   void AddToThreadq(Threadq* q, int id0, int c, int flag,
107:   // Frees all the threads on runq.
109:   inline int Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p);
123:   Threadq q0_, q1_;     // pre-allocated for Search.
151:   free_threads_ = NULL;
173:   free_threads_ = t->next;
191:   t->next = free_threads_;
192:   free_threads_ = t;
287:         t = AllocThread();
332: // Frees all the threads on runq.
334: int NFA::Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p) {
337:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
343:       // Can skip any threads started after our current best match.
402:           // Cut off the threads that can only find matches
404:           // rest of the current Threadq.
500:   Threadq* runq = &q0_;
501:   Threadq* nextq = &q1_;
547:       for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
627:     // If all the threads have died, stop early.
637:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i)
72:   // State for explicit stack in AddToThreadq.
126:   AddState* astack_;    // pre-allocated for AddToThreadq
144:   // See NFA::AddToThreadq() for why this is so.
254:       LOG(DFATAL) << "unhandled " << ip->opcode() << " in AddToThreadq";
360:         AddToThreadq(nextq, ip->out(), c, flag, p+1, t);
558:     // c and flag through to AddToThreadq() along with p-1+1, which is p.
623:       AddToThreadq(runq, start_, p < text.end() ? p[0] & 0xFF : -1, flag, p, t);
github.com/fuchsia-mirror/magenta-benchmarks:threads.cc: [ master, ] c++
9: class Thread : public benchmark::Fixture {};
11: BENCHMARK_F(Thread, Create)(benchmark::State& state) {
13:   constexpr char tname[] = "test thread";
15:     if (zx_thread_create(zx_process_self(), tname, sizeof(tname), 0, &out) != ZX_OK) {
16:       state.SkipWithError("Failed to create thread");
25: BENCHMARK_F(Thread, CreateAndJoin)(benchmark::State& state) {
26:   zx_handle_t thread;
27:   constexpr char tname[] = "test thread";
29:     if (zx_thread_create(zx_process_self(), tname, sizeof(tname), 0, &thread) != ZX_OK) {
30:       state.SkipWithError("Failed to create thread");
48:     uintptr_t entry = reinterpret_cast<uintptr_t>(&zx_thread_exit);
50:     if (zx_thread_start(thread, entry, stack, 0, 0) != ZX_OK) {
51:       state.SkipWithError("Failed to start thread");
56:     if (zx_object_wait_one(thread, ZX_THREAD_TERMINATED, ZX_TIME_INFINITE, &observed) != ZX_OK) {
57:       state.SkipWithError("Failed to wait for thread");
62:     zx_handle_close(thread);
github.com/apache/xerces2-j:tests/thread/Test.java: [ trunk, ] java
18: package thread;
657: class thread extends Thread {
661:     thread (ThreadInfo param) {
104: class ThreadInfo
111:     ThreadInfo() {
140: class ThreadParser extends HandlerBase
171: ThreadParser()
84:     int         numThreads;
109:     int        fThreadNum;      // Identifying number for this thread.
126: ThreadInfo      gThreadInfo[];
66:     int     checkSum;        // The XML checksum.  Set up by the main thread for
98: //  struct threadInfo  Holds information specific to an individual thread.
99: //                     One of these is set up for each thread in the test.
106:     boolean    fHeartBeat;      // Set true by the thread each time it finishes
577:         System.err.print("usage: java thread.Test [-v] [-threads nnn] [-time nnn] [-quiet] [-verbose] xmlfile...\n" +
600: //                          thread, before all of the worker threads are started.
649: //               thread termination.  Threads are stuck running here
651: //               main thread of the process (which never calls this
670:         System.out.println("Thread " + thInfo.fThreadNum + ": starting");
692:             System.out.println("Thread " + thInfo.fThreadNum +
726: } // class thread
796:         thread t = new thread(gThreadInfo[threadNum]);
803:     //                 display "." if some thread hasn't since previous "+"
811:             Thread.sleep(1000);
839:     //  To Do:  Run the main thread at higher priority, so that the worker threads
40:  * This program is a straight port of xerces/c/tests/ThreadTest.cpp
56: //                      and can safely be referenced by the test threads without
67:                              //   each file before the worker threads are started.
75: //                     During the test, the threads will access this info without
100: //                     The main program monitors the threads by looking
132: //  class ThreadParser   Bundles together a SAX parser and the SAX handlers
137: //                       in different threads.
168: //  ThreadParser constructor.  Invoked by the threads of the test program
263: //  addToCheckSum - private function, used within ThreadParser in
275: //  addToCheckSum - private function, used within ThreadParser in
468: } // class ThreadParser
516:             else if (argv[argnum].equals("-threads"))
583:             "     -threads nnn   Number of threads.  Default is 2. \n" +
644: //  threadMain   The main function for each of the swarm of test threads.
659:     ThreadInfo thInfo;
667:     ThreadParser thParser = null;
682:             thParser = new ThreadParser();
701:             System.err.println("\nThread " + thInfo.fThreadNum +
747:     // While we are still single threaded, parse each of the documents
751:     ThreadParser mainParser = new ThreadParser();
783:     //  Fire off the requested number of parallel threads
789:     gThreadInfo = new ThreadInfo[gRunInfo.numThreads];
791:     int threadNum;
792:     for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
794:         gThreadInfo[threadNum] = new ThreadInfo();
795:         gThreadInfo[threadNum].fThreadNum = threadNum;
801:     //  Loop, watching the heartbeat of the worker threads.
802:     //    Each second, display "+" when all threads have completed a parse
819:             for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
821:                 if (gThreadInfo[threadNum].fHeartBeat == false)
830:                 for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
831:                     gThreadInfo[threadNum].fHeartBeat = false;
838:     //  Tally up the total number of parses completed by each of the threads.
843:     for (threadNum=0; threadNum < gRunInfo.numThreads; threadNum++)
845:         totalParsesCompleted += gThreadInfo[threadNum].fParses;
853:     //  The threads are still running; we just return
114:         fThreadNum = -1;
487:     gRunInfo.numThreads = 2;
522:                     gRunInfo.numThreads = Integer.parseInt(argv[argnum]);
527:                 if (gRunInfo.numThreads < 0)
786:     if (gRunInfo.numThreads == 0)
github.com/apache/kafka:clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java: [ trunk, ] java
209:     private final Thread thread;
999:         private boolean threadShouldExit(long now, long curHardShutdownTimeMs) {
202:      * The runnable used in the service thread for this admin client.
207:      * The network service thread for this admin client.
213:      * and force the RPC thread to exit. If the admin client is not closing, this will be 0.
218:      * A factory which creates TimeoutProcessors for the RPC thread.
405:         String threadName = "kafka-admin-client-thread | " + clientId;
406:         this.thread = new KafkaThread(threadName, runnable, true);
413:         thread.start();
434:                 client.wakeup(); // Wake the thread, if it is blocked inside poll().
446:             log.debug("Waiting for the I/O thread to exit. Hard shutdown in {} ms.", deltaMs);
449:             // Wait for the thread to be joined.
450:             thread.join();
456:             log.debug("Interrupted while joining I/O thread", e);
457:             Thread.currentThread().interrupt();
741:          * Only accessed from this thread.
747:          * Only accessed from this thread.
753:          * Only accessed from this thread.
759:          * Only accessed from this thread.
765:          * This will be null only if the thread has shut down.
1001:                 log.trace("All work has been completed, and the I/O thread is now exiting.");
1005:                 log.info("Forcing a hard I/O thread shutdown. Requests in progress will be aborted.");
1015:             log.trace("Thread starting");
1020:                 // Check if the AdminClient thread should shut down.
1064:                 numTimedOut += timeoutProcessor.handleTimeouts(newCalls, "The AdminClient thread has exited.");
1067:             numTimedOut += timeoutProcessor.handleTimeouts(pendingCalls, "The AdminClient thread has exited.");
1070:                     "The AdminClient thread has exited.");
1076:             log.debug("Exiting AdminClientRunnable thread.");
1082:          * If the AdminClient thread has exited, this will fail. Otherwise, it will succeed (even
1101:                 client.wakeup(); // wake the thread if it is in poll()
1103:                 log.debug("The AdminClient thread has exited. Timing out {}.", call);
1104:                 call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread has exited."));
1119:                 call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread is not accepting new calls."));
121: import org.apache.kafka.common.utils.KafkaThread;
1022:                 if ((curHardShutdownTimeMs != INVALID_SHUTDOWN_TIME) && threadShouldExit(now, curHardShutdownTimeMs))
github.com/google/guava:guava/src/com/google/common/util/concurrent/AbstractFuture.java: [ master, ] java
173:     volatile @Nullable Thread thread;
1038:     abstract void putThread(Waiter waiter, Thread newValue);
1108:     void putThread(Waiter waiter, Thread newValue) {
1158:     void putThread(Waiter waiter, Thread newValue) {
1191:     void putThread(Waiter waiter, Thread newValue) {
1064:     static final long WAITER_THREAD_OFFSET;
1138:     final AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater;
139:                 newUpdater(Waiter.class, Thread.class, "thread"),
184:       ATOMIC_HELPER.putThread(this, Thread.currentThread());
195:       // unpark even though the thread has already removed itself from the list. But even if we did
197:       Thread w = thread;
199:         thread = null;
211:    *   <li>This is only called when a waiting thread times out or is interrupted. Both of which
217:     node.thread = null; // mark as 'deleted'
228:         if (curr.thread != null) { // we aren't unlinking this node, update pred.
232:           if (pred.thread == null) { // We raced with another node that unlinked pred. Restart.
366:   //   have observed 12 micros on 64 bit linux systems to wake up a parked thread). So if the
383:    * current thread is interrupted during the call, even if the value is already available.
394:     if (Thread.interrupted()) {
414:               if (Thread.interrupted()) {
429:                 // Remove the waiter, one way or another we are done parking this thread.
449:       if (Thread.interrupted()) {
475:    * current thread is interrupted during the call, even if the value is already available.
482:     if (Thread.interrupted()) {
499:             if (Thread.interrupted()) {
1010:     // detect arbitrary cycles using a thread local or possibly by catching StackOverflowExceptions
1037:     /** Non volatile write of the thread to the {@link Waiter#thread} field. */
1098:         WAITER_THREAD_OFFSET = unsafe.objectFieldOffset(Waiter.class.getDeclaredField("thread"));
1109:       UNSAFE.putObject(waiter, WAITER_THREAD_OFFSET, newValue);
1145:         AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater,
1192:       waiter.thread = newValue;
349:   /** All waiting threads. */
832:   /** Unblocks all threads and runs all listeners. */
909:   /** Releases all threads in the {@link #waiters} list, and clears the list. */
1150:       this.waiterThreadUpdater = waiterThreadUpdater;
1159:       waiterThreadUpdater.lazySet(waiter, newValue);
github.com/google/guava:android/guava/src/com/google/common/util/concurrent/AbstractFuture.java: [ master, ] java
173:     @NullableDecl volatile Thread thread;
1039:     abstract void putThread(Waiter waiter, Thread newValue);
1109:     void putThread(Waiter waiter, Thread newValue) {
1159:     void putThread(Waiter waiter, Thread newValue) {
1192:     void putThread(Waiter waiter, Thread newValue) {
1065:     static final long WAITER_THREAD_OFFSET;
1139:     final AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater;
139:                 newUpdater(Waiter.class, Thread.class, "thread"),
184:       ATOMIC_HELPER.putThread(this, Thread.currentThread());
195:       // unpark even though the thread has already removed itself from the list. But even if we did
197:       Thread w = thread;
199:         thread = null;
211:    *   <li>This is only called when a waiting thread times out or is interrupted. Both of which
217:     node.thread = null; // mark as 'deleted'
228:         if (curr.thread != null) { // we aren't unlinking this node, update pred.
232:           if (pred.thread == null) { // We raced with another node that unlinked pred. Restart.
366:   //   have observed 12 micros on 64 bit linux systems to wake up a parked thread). So if the
383:    * current thread is interrupted during the call, even if the value is already available.
394:     if (Thread.interrupted()) {
414:               if (Thread.interrupted()) {
429:                 // Remove the waiter, one way or another we are done parking this thread.
449:       if (Thread.interrupted()) {
475:    * current thread is interrupted during the call, even if the value is already available.
482:     if (Thread.interrupted()) {
499:             if (Thread.interrupted()) {
1011:     // detect arbitrary cycles using a thread local or possibly by catching StackOverflowExceptions
1038:     /** Non volatile write of the thread to the {@link Waiter#thread} field. */
1099:         WAITER_THREAD_OFFSET = unsafe.objectFieldOffset(Waiter.class.getDeclaredField("thread"));
1110:       UNSAFE.putObject(waiter, WAITER_THREAD_OFFSET, newValue);
1146:         AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater,
1193:       waiter.thread = newValue;
349:   /** All waiting threads. */
832:   /** Unblocks all threads and runs all listeners. */
909:   /** Releases all threads in the {@link #waiters} list, and clears the list. */
1151:       this.waiterThreadUpdater = waiterThreadUpdater;
1160:       waiterThreadUpdater.lazySet(waiter, newValue);
github.com/google/binnavi:debug/client/windynamorio/drdebug.proto: [ master, ] protobuf
347:   optional uint64 thread  = 5; // required
54:     SUSPEND_THREAD        = 9;
55:     RESUME_THREAD         = 10;
75:   repeated uint64 thread_id = 2;
185:     UNKNOWN_THREAD             = 12;
232:   repeated uint64 thread_id = 1;
306:     THREAD_CREATED   = 2;
307:     THREAD_EXITED    = 3;
318:   optional ThreadCreatedInfo   thread_created_info   = 3;
319:   optional ThreadExitedInfo    thread_exited_info    = 4;
330:   optional uint64 thread_id = 3; // required
334:   optional uint64 thread_id = 1; // required
338:   optional uint64 thread_id = 1; // required
357:   optional uint64 thread_id    = 3; // required
365:   optional uint64 thread_id = 1; // required
333: message ThreadCreatedInfo {
337: message ThreadExitedInfo {
84:   optional SuspendThreadArgs       suspend_thread_args        = 9;
85:   optional ResumeThreadArgs        resume_thread_args         = 10;
206:   optional SuspendThreadResult       suspend_thread_result        = 9;
207:   optional ResumeThreadResult        resume_thread_result         = 10;
53:     LIST_THREADS          = 8;
83:   optional ListThreadsArgs         list_threads_args          = 8;
205:   optional ListThreadsResult         list_threads_result          = 8;
118: message ListThreadsArgs {
121: message SuspendThreadArgs {
124: message ResumeThreadArgs {
231: message ListThreadsResult {
235: message SuspendThreadResult {
238: message ResumeThreadResult {
52:     // thread control
74:   //       not all commands could be executed thread-locally (like write memory)
186:     // Someone tried to resume already running thread.
72:   // execute the command only on those threads
github.com/apache/beam:sdks/go/pkg/beam/model/fnexecution_v1/beam_fn_api.pb.go: [ master, ] go
2232: 	Thread string `protobuf:"bytes,8,opt,name=thread" json:"thread,omitempty"`
2289: func (m *LogEntry) GetThread() string {
2231: 	// (Optional) The name of the thread this log statement is associated with.
2291: 		return m.Thread
github.com/google/binnavi:debug/client/defs.hpp: [ master, ] c++
232: struct Thread {
247:   Thread(unsigned int tid, ThreadState state)
136: enum ThreadState {
264:   typedef std::function<bool(const Thread&)> ThreadComparator;
586:   std::vector<Thread> threads;
589:   void addThread(const Thread& thread) {
158:   dbgevt_thread_created,
161:   dbgevt_thread_closed,
266:   static ThreadComparator MakeThreadIdComparator(int tid) {
593:   std::vector<Thread> getThreads() const {
135: // Identifies the state of a thread
137:   // Thread is running
140:   // Thread is suspended
157:   // A new thread was created in the target process
160:   // An existing thread was closed in the target process
230:  * Describes a thread of the target process
233:   //  The thread ID of the thread
236:   // The state of the thread
242:    * Creates a new Thread object
244:    * @param tid The thread ID of the thread
245:    * @param state The state of the thread
252:   bool operator==(const Thread& rhs) const {
256:   bool operator<(const Thread& rhs) const {
261:    * Returns a function which matches the thread with a given id
267:     return [tid](const Thread& t)->bool {return t.tid == tid; };
414:   // Thread ID of the thread where the exception happened
590:     threads.push_back(thread);
717:       std::vector<Thread> threads = registers.getThreads();
719:       for (std::vector<Thread>::iterator Iter = threads.begin();
721:         Thread t = *Iter;
237:   ThreadState state;
594:     return threads;
720:           Iter != threads.end(); ++Iter) {
github.com/dart-lang/sdk:runtime/vm/compiler/frontend/kernel_to_il.h: [ master, ] c++
318:   Thread* thread() { return thread_; }
461:   Thread* thread_;
661:   Thread* thread_;
843:   Thread* thread_;
308:   explicit TranslationHelper(Thread* thread);
547:         thread_(Thread::Current()),
548:         zone_(thread_->zone()),
629:     intptr_t deopt_id = thread_->GetNextDeoptId();
838:   bool IsCompiledForOsr() { return osr_id_ != Thread::kNoDeoptId; }
github.com/chromium/chromium:sandbox/win/src/nt_internals.h: [ master, ] c++
792:   HANDLE thread;
37: #define CURRENT_THREAD ((HANDLE)-2)
265:   PVOID UniqueThread;
281:   ThreadBasicInformation,
282:   ThreadTimes,
283:   ThreadPriority,
284:   ThreadBasePriority,
285:   ThreadAffinityMask,
286:   ThreadImpersonationToken,
287:   ThreadDescriptorTableEntry,
288:   ThreadEnableAlignmentFaultFixup,
289:   ThreadEventPair,
290:   ThreadQuerySetWin32StartAddress,
291:   ThreadZeroTlsCell,
292:   ThreadPerformanceCount,
293:   ThreadAmILastThread,
294:   ThreadIdealProcessor,
295:   ThreadPriorityBoost,
296:   ThreadSetTlsArrayAddress,
297:   ThreadIsIoPending,
298:   ThreadHideFromDebugger
280: typedef enum _NT_THREAD_INFORMATION_CLASS {
299: } NT_THREAD_INFORMATION_CLASS,
300:     *PNT_THREAD_INFORMATION_CLASS;
268: typedef NTSTATUS(WINAPI* NtOpenThreadFunction)(OUT PHANDLE ThreadHandle,
302: typedef NTSTATUS(WINAPI* NtSetInformationThreadFunction)(
360: typedef NTSTATUS(WINAPI* NtOpenThreadTokenFunction)(IN HANDLE ThreadHandle,
366: typedef NTSTATUS(WINAPI* NtOpenThreadTokenExFunction)(IN HANDLE ThreadHandle,
391: typedef NTSTATUS(WINAPI* RtlCreateUserThreadFunction)(
261: // Process and Thread
304:     IN NT_THREAD_INFORMATION_CLASS ThreadInformationClass,
400:     OUT PHANDLE Thread,
303:     IN HANDLE ThreadHandle,
305:     IN PVOID ThreadInformation,
306:     IN ULONG ThreadInformationLength);
393:     IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor,
398:     IN LPTHREAD_START_ROUTINE StartAddress,
github.com/chromium/chromium:base/debug/activity_tracker.h: [ master, ] c++
119:   } thread;
118:     int64_t thread_id;  // A unique identifier for a thread within a process.
279:     ACT_THREAD = 4 << 4,
594:     std::string thread_name;
604:     int64_t thread_id = 0;
751:   const PlatformThreadRef thread_id_;  // The thread this instance is bound to.
1201:   std::atomic<int> thread_tracker_count_;
1204:   ActivityTrackerMemoryAllocator thread_tracker_allocator_;
1205:   Lock thread_tracker_allocator_lock_;
160:   static ActivityData ForThread(const int64_t id) {
574: class BASE_EXPORT ThreadActivityTracker {
950:   ThreadActivityTracker* GetTrackerForCurrentThread() {
957:   ThreadActivityTracker* GetOrCreateTrackerForCurrentThread() {
1077:   class ThreadSafeUserData : public ActivityUserData {
280:     ACT_THREAD_START = ACT_THREAD,
281:     ACT_THREAD_JOIN,
1198:   ThreadLocalStorage::Slot this_thread_tracker_;
840:   class BASE_EXPORT ScopedThreadActivity
1069:     kMaxThreadCount = 100,
1070:     kCachedThreadMemories = 10,
1328: class BASE_EXPORT ScopedThreadJoinActivity
1332:   explicit ScopedThreadJoinActivity(const PlatformThreadHandle* thread)
36: #include "base/threading/platform_thread.h"
37: #include "base/threading/thread_local_storage.h"
162:     data.thread.thread_id = id;
184: // persistent memory allocator. Instances of this class are NOT thread-safe.
185: // Use from a single thread or protect access with a lock.
263:     // Task activities involve callbacks posted to a thread or thread-pool
278:     // Thread activities involve the life management of threads.
309:   // from a completely different thread though most activities will leave
345: // done by a thread by supporting key/value pairs of any type. This can provide
347: // global data. All updates must be done from the same thread though other
411:   // contents have been overwritten by another thread. The return value is
537:   // gone away (cleared by another thread/process), it will invalidate all the
565: // This class manages tracking a stack of activities for a single thread in
568: // thread is analyzing this data in real-time, atomic operations are used
578:   // This structure contains all the common information about the thread so
585:   // so that continued operation of the thread will not cause changes here.
592:     // The name of the thread as set when it was created. The name may be
599:     // The process and thread IDs. These values have no meaning other than
600:     // they uniquely identify a running process and a running thread within
601:     // that process.  Thread-IDs can be re-used across different processes
602:     // and both can be re-used after the process/thread exits.
606:     // The current stack of activities that are underway for this thread. It
635:     // The thread tracker to which this object reports. It can be null if
748:   // The ActivityTracker is thread bound, and will be invoked across all the
749:   // sequences that run on the thread. A ThreadChecker does not work here, as it
761: // The global tracker manages all the individual thread trackers. Memory for
762: // the thread trackers is taken from a PersistentMemoryAllocator which allows
837:   // This is a thin wrapper around the thread-tracker's ScopedActivity that
838:   // allows thread-safe access to data values. It is safe to use even if
854:     // Gets (or creates) a tracker for the current thread. If locking is not
857:     // the tracker for this thread has been created for other reasons, locks
858:     // will be tracked. The thread-tracker uses locks.
878:   // providing the given |stack_depth| to each thread tracker it manages. The
934:   // calling this. Tracking for the current thread will be automatically
946:   // Gets the thread's activity-tracker if it exists. This is inline for
947:   // performance reasons and it uses thread-local-storage (TLS) so that there
949:   // thread. Ownership remains with the global tracker.
951:     return reinterpret_cast<ThreadActivityTracker*>(this_thread_tracker_.Get());
954:   // Gets the thread's activity-tracker or creates one if none exists. This
964:   // Creates an activity-tracker for the current thread.
967:   // Releases the activity-tracker for the current thread (for testing only).
1032:   // Record field trial information. This call is thread-safe. In addition to
1043:   // Record exception information for the current thread.
1058:   // Updates to this are thread-safe.
1074:   // A wrapper around ActivityUserData that is thread-safe and thus can be used
1076:   // thread.
1138:   // A thin wrapper around the main thread-tracker that keeps additional
1147:     // The reference into persistent memory from which the thread-tracker's
1151:     // The physical address used for the thread-tracker's memory.
1159:   // providing the given |stack_depth| to each thread tracker it manages. The
1174:   // Releases the activity-tracker associcated with thread. It is called
1175:   // automatically when a thread is joined and thus there is nothing more to
1179:   // Does process-exit work. This can be run on any thread.
1197:   // The activity tracker for the currently executing thread.
1200:   // The number of thread trackers currently active.
1203:   // A caching memory allocator for thread-tracker objects.
1211:   // An object for holding arbitrary key value pairs with thread-safe access.
1232:   // the |background_task_runner_| if one is set or whatever thread reaped
1333:       : ScopedThreadJoinActivity(GetProgramCounter(), thread) {}
1337:                            const PlatformThreadHandle* thread);
9: // what all the various threads and processes are (or were) doing.
51: class ThreadActivityTracker;
159:   static ActivityData ForThread(const PlatformThreadHandle& handle);
348: // threads can read it concurrently if they create new objects using the same
624:     ScopedActivity(ThreadActivityTracker* tracker,
637:     ThreadActivityTracker* const tracker_;
646:   // A ThreadActivityTracker runs on top of memory that is managed externally.
649:   ThreadActivityTracker(void* base, size_t size);
650:   virtual ~ThreadActivityTracker();
738:   bool CalledOnValidThread();
757:   DISALLOW_COPY_AND_ASSIGN(ThreadActivityTracker);
841:       : public ThreadActivityTracker::ScopedActivity {
859:     static ThreadActivityTracker* GetOrCreateTracker(bool lock_allowed) {
864:         return global_tracker->GetOrCreateTrackerForCurrentThread();
866:         return global_tracker->GetTrackerForCurrentThread();
933:   // the global tracker completely. All tracked threads must exit before
958:     ThreadActivityTracker* tracker = GetTrackerForCurrentThread();
961:     return CreateTrackerForCurrentThread();
965:   ThreadActivityTracker* CreateTrackerForCurrentThread();
1067:     // The maximum number of threads that can be tracked within a process. If
1079:     ThreadSafeUserData(void* memory, size_t size, int64_t pid = 0);
1080:     ~ThreadSafeUserData() override;
1090:     DISALLOW_COPY_AND_ASSIGN(ThreadSafeUserData);
1139:   // information that the global tracker needs to handle joined threads.
1140:   class ManagedActivityTracker : public ThreadActivityTracker {
1189:   // The size (in bytes) of memory required by a ThreadActivityTracker to
1212:   ThreadSafeUserData process_data_;
45: class PlatformThreadHandle;
843:     ScopedThreadActivity(const void* program_counter,
848:     ~ScopedThreadActivity();
872:     DISALLOW_COPY_AND_ASSIGN(ScopedThreadActivity);
968:   void ReleaseTrackerForCurrentThreadForTesting();
1063:   friend class ScopedThreadActivity;
1242:     : public GlobalActivityTracker::ScopedThreadActivity {
1291:     : public GlobalActivityTracker::ScopedThreadActivity {
1303:     : public GlobalActivityTracker::ScopedThreadActivity {
1316:     : public GlobalActivityTracker::ScopedThreadActivity {
1329:     : public GlobalActivityTracker::ScopedThreadActivity {
1336:   ScopedThreadJoinActivity(const void* program_counter,
1338:   DISALLOW_COPY_AND_ASSIGN(ScopedThreadJoinActivity);
1344:     : public GlobalActivityTracker::ScopedThreadActivity {
github.com/fuchsia-mirror/zircon:third_party/lib/acpica/source/include/acpica/aclocal.h: [ master, ] c++
825:     ACPI_THREAD_STATE               Thread;
135:     ACPI_THREAD_ID                  ThreadId;
764:     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
1308:     ACPI_HANDLE                     ThreadCompleteGate;
1310:     ACPI_THREAD_ID                  *Threads;
124: #define ACPI_INVALID_THREAD_ID          ACPI_OS_INVALID_THREAD_ID
126: #define ACPI_INVALID_THREAD_ID          ((ACPI_THREAD_ID) 0xFFFFFFFF)
758: typedef struct acpi_thread_state
766: } ACPI_THREAD_STATE;
1307:     ACPI_HANDLE                     MainThreadGate;
1311:     UINT32                          NumThreads;
1333:     char                            NumThreadsStr[11];
1334:     char                            IdOfThreadStr[11];
1335:     char                            IndexOfThreadStr[11];
117: /* This Thread ID means that the mutex is not in use (unlocked) */
119: #define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
121: /* This Thread ID means an invalid thread ID */
123: #ifdef ACPI_OS_INVALID_THREAD_ID
755:  * Thread state - one per thread across multiple walk states. Multiple walk
762:     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
1325:      *   the Number of threads, ID of current thread and
1326:      *   Index of current thread inside all them created.
1324:      * Threads -
github.com/firebase/firebase-ios-sdk:Firebase/Messaging/Protos/GtalkCore.pbobjc.h: [ master, ] objectivec
809: @property(nonatomic, readwrite, copy, null_resettable) NSString *thread;
811: @property(nonatomic, readwrite) BOOL hasThread;
761:   GtalkMessageStanza_FieldNumber_Thread = 8,
810: /** Test to see if @c thread has been set. */
github.com/google/proto-quic:src/base/debug/activity_tracker.h: [ master, ] c++
119:   } thread;
118:     int64_t thread_id;  // A unique identifier for a thread within a process.
279:     ACT_THREAD = 4 << 4,
594:     std::string thread_name;
604:     int64_t thread_id = 0;
745:   base::ThreadChecker thread_checker_;
1179:   std::atomic<int> thread_tracker_count_;
1182:   ActivityTrackerMemoryAllocator thread_tracker_allocator_;
1183:   base::Lock thread_tracker_allocator_lock_;
160:   static ActivityData ForThread(const int64_t id) {
574: class BASE_EXPORT ThreadActivityTracker {
925:   ThreadActivityTracker* GetTrackerForCurrentThread() {
932:   ThreadActivityTracker* GetOrCreateTrackerForCurrentThread() {
1053:   class ThreadSafeUserData : public ActivityUserData {
280:     ACT_THREAD_START = ACT_THREAD,
281:     ACT_THREAD_JOIN,
1176:   base::ThreadLocalStorage::Slot this_thread_tracker_;
830:   class BASE_EXPORT ScopedThreadActivity
1045:     kMaxThreadCount = 100,
1046:     kCachedThreadMemories = 10,
1313: class BASE_EXPORT ScopedThreadJoinActivity
1317:   explicit ScopedThreadJoinActivity(const base::PlatformThreadHandle* thread)
35: #include "base/threading/platform_thread.h"
36: #include "base/threading/thread_checker.h"
37: #include "base/threading/thread_local_storage.h"
162:     data.thread.thread_id = id;
184: // persistent memory allocator. Instances of this class are NOT thread-safe.
185: // Use from a single thread or protect access with a lock.
263:     // Task activities involve callbacks posted to a thread or thread-pool
278:     // Thread activities involve the life management of threads.
309:   // from a completely different thread though most activities will leave
345: // done by a thread by supporting key/value pairs of any type. This can provide
347: // global data. All updates must be done from the same thread though other
411:   // contents have been overwritten by another thread. The return value is
537:   // gone away (cleared by another thread/process), it will invalidate all the
565: // This class manages tracking a stack of activities for a single thread in
568: // thread is analyzing this data in real-time, atomic operations are used
578:   // This structure contains all the common information about the thread so
585:   // so that continued operation of the thread will not cause changes here.
592:     // The name of the thread as set when it was created. The name may be
599:     // The process and thread IDs. These values have no meaning other than
600:     // they uniquely identify a running process and a running thread within
601:     // that process.  Thread-IDs can be re-used across different processes
602:     // and both can be re-used after the process/thread exits.
606:     // The current stack of activities that are underway for this thread. It
635:     // The thread tracker to which this object reports. It can be null if
751: // The global tracker manages all the individual thread trackers. Memory for
752: // the thread trackers is taken from a PersistentMemoryAllocator which allows
827:   // This is a thin wrapper around the thread-tracker's ScopedActivity that
828:   // allows thread-safe access to data values. It is safe to use even if
844:     // Gets (or creates) a tracker for the current thread. If locking is not
847:     // the tracker for this thread has been created for other reasons, locks
848:     // will be tracked. The thread-tracker uses locks.
868:   // providing the given |stack_depth| to each thread tracker it manages. The
909:   // calling this. Tracking for the current thread will be automatically
921:   // Gets the thread's activity-tracker if it exists. This is inline for
922:   // performance reasons and it uses thread-local-storage (TLS) so that there
924:   // thread. Ownership remains with the global tracker.
926:     return reinterpret_cast<ThreadActivityTracker*>(this_thread_tracker_.Get());
929:   // Gets the thread's activity-tracker or creates one if none exists. This
939:   // Creates an activity-tracker for the current thread.
942:   // Releases the activity-tracker for the current thread (for testing only).
1007:   // Record field trial information. This call is thread-safe. In addition to
1018:   // Record exception information for the current thread.
1034:   // Updates to this are thread-safe.
1050:   // A wrapper around ActivityUserData that is thread-safe and thus can be used
1052:   // thread.
1116:   // A thin wrapper around the main thread-tracker that keeps additional
1125:     // The reference into persistent memory from which the thread-tracker's
1129:     // The physical address used for the thread-tracker's memory.
1137:   // providing the given |stack_depth| to each thread tracker it manages. The
1152:   // Releases the activity-tracker associcated with thread. It is called
1153:   // automatically when a thread is joined and thus there is nothing more to
1157:   // Does process-exit work. This can be run on any thread.
1175:   // The activity tracker for the currently executing thread.
1178:   // The number of thread trackers currently active.
1181:   // A caching memory allocator for thread-tracker objects.
1189:   // An object for holding arbitrary key value pairs with thread-safe access.
1210:   // the |background_task_runner_| if one is set or whatever thread reaped
1319:                                  thread) {}
1323:                            const base::PlatformThreadHandle* thread);
9: // what all the various threads and processes are (or were) doing.
51: class ThreadActivityTracker;
159:   static ActivityData ForThread(const PlatformThreadHandle& handle);
348: // threads can read it concurrently if they create new objects using the same
624:     ScopedActivity(ThreadActivityTracker* tracker,
637:     ThreadActivityTracker* const tracker_;
646:   // A ThreadActivityTracker runs on top of memory that is managed externally.
649:   ThreadActivityTracker(void* base, size_t size);
650:   virtual ~ThreadActivityTracker();
747:   DISALLOW_COPY_AND_ASSIGN(ThreadActivityTracker);
831:       : public ThreadActivityTracker::ScopedActivity {
849:     static ThreadActivityTracker* GetOrCreateTracker(bool lock_allowed) {
854:         return global_tracker->GetOrCreateTrackerForCurrentThread();
856:         return global_tracker->GetTrackerForCurrentThread();
908:   // the global tracker completely. All tracked threads must exit before
933:     ThreadActivityTracker* tracker = GetTrackerForCurrentThread();
936:     return CreateTrackerForCurrentThread();
940:   ThreadActivityTracker* CreateTrackerForCurrentThread();
1043:     // The maximum number of threads that can be tracked within a process. If
1055:     ThreadSafeUserData(void* memory, size_t size, int64_t pid = 0);
1056:     ~ThreadSafeUserData() override;
1066:     DISALLOW_COPY_AND_ASSIGN(ThreadSafeUserData);
1117:   // information that the global tracker needs to handle joined threads.
1118:   class ManagedActivityTracker : public ThreadActivityTracker {
1167:   // The size (in bytes) of memory required by a ThreadActivityTracker to
1190:   ThreadSafeUserData process_data_;
45: class PlatformThreadHandle;
833:     ScopedThreadActivity(const void* program_counter,
838:     ~ScopedThreadActivity();
862:     DISALLOW_COPY_AND_ASSIGN(ScopedThreadActivity);
943:   void ReleaseTrackerForCurrentThreadForTesting();
1039:   friend class ScopedThreadActivity;
1220:     : public GlobalActivityTracker::ScopedThreadActivity {
1272:     : public GlobalActivityTracker::ScopedThreadActivity {
1286:     : public GlobalActivityTracker::ScopedThreadActivity {
1300:     : public GlobalActivityTracker::ScopedThreadActivity {
1314:     : public GlobalActivityTracker::ScopedThreadActivity {
1318:       : ScopedThreadJoinActivity(::tracked_objects::GetProgramCounter(),
1322:   ScopedThreadJoinActivity(const void* program_counter,
1324:   DISALLOW_COPY_AND_ASSIGN(ScopedThreadJoinActivity);
1330:     : public GlobalActivityTracker::ScopedThreadActivity {
github.com/google/gapid:gapis/service/path/path.go: [ master, ] go
578: func (n *Capture) Thread(id uint64) *Thread {
577: // Thread returns the path node to the thread with the given ID.
579: 	return &Thread{Capture: n, Id: id}
android.googlesource.com/platform/external/lzma:CPP/7zip/UI/Common/Bench.cpp: [ master, ] c++
695:   NWindows::CThread thread[2];
1513:   NWindows::CThread Thread;
1564:   NWindows::CThread Thread;
800:   HRESULT CreateEncoderThread()
805:   HRESULT CreateDecoderThread(unsigned index, bool callbackMode
696:   UInt32 NumDecoderSubThreads;
765:   static THREAD_FUNC_DECL EncodeThreadFunction(void *param)
787:   static THREAD_FUNC_DECL DecodeThreadFunction(void *param)
1142: static const UInt32 kNumThreadsMax = (1 << 12);
1527: static THREAD_FUNC_DECL FreqThreadFunction(void *param)
1543: struct CFreqThreads
1546:   UInt32 NumThreads;
1548:   CFreqThreads(): Items(0), NumThreads(0) {}
1555:   ~CFreqThreads()
1587: static THREAD_FUNC_DECL CrcThreadFunction(void *param)
1601: struct CCrcThreads
1604:   UInt32 NumThreads;
1606:   CCrcThreads(): Items(0), NumThreads(0) {}
1613:   ~CCrcThreads()
1868: AString GetProcessThreadsInfo(const NSystem::CProcessAffinity &ti)
2370: static UInt32 GetNumThreadsNext(unsigned i, UInt32 numThreads)
37: #include "../../../Windows/Thread.h"
802:     return thread[0].Create(EncodeThreadFunction, this);
820:     return thread[index].Create(DecodeThreadFunction, &decoder);
1314:       encoders[i].thread[0].Wait();
1387:         encoder.thread[j].Wait();
1404:         if (::GetThreadTimes(encoders[i].thread[j], &creationTime, &exitTime, &kernelTime, &userTime) != 0)
1522:     Thread.Wait();
1523:     Thread.Close();
1582:     Thread.Wait();
1583:     Thread.Close();
2117:       RINOK(info.Thread.Create(FreqThreadFunction, &info));
2253:       RINOK(info.Thread.Create(CrcThreadFunction, &info));
441:     ::GetThreadTimes(::GetCurrentThread()
1302:       RINOK(encoder.CreateEncoderThread())
1365:         HRESULT res = encoder.CreateDecoderThread(j, (i == 0 && j == 0)
1428: static inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
1441:       (1 << 20) + (multiThread ? (6 << 20) : 0);
1892:     bool size_Defined, UInt64 size, const char *threadsString, UInt32 numThreads)
1904:   f.Print(threadsString);
2100:   CFreqThreads threads;
2103:     threads.Items = new CFreqInfo[numThreads];
2107:       CFreqInfo &info = threads.Items[i];
2116:       CFreqInfo &info = threads.Items[i];
2118:       threads.NumThreads++;
2120:     threads.WaitAll();
2123:       RINOK(threads.Items[i].CallbackRes);
2209:   CCrcThreads threads;
2212:     threads.Items = new CCrcInfo[numThreads];
2217:       CCrcInfo &info = threads.Items[i];
2252:       CCrcInfo &info = threads.Items[i];
2254:       threads.NumThreads++;
2256:     threads.WaitAll();
2259:       RINOK(threads.Items[i].Res);
2770:   NSystem::CProcessAffinity threadsInfo;
2771:   threadsInfo.InitST();
2775:   if (threadsInfo.Get() && threadsInfo.processAffinityMask != 0)
2776:     numCPUs = threadsInfo.GetNumProcessThreads();
3010:     PrintRequirements(*printCallback, "size: ", ramSize_Defined, ramSize, "CPU hardware threads:", numCPUs);
3011:     printCallback->Print(GetProcessThreadsInfo(threadsInfo));
3164:   // ---------- Threads loop ----------
3165:   for (unsigned threadsPassIndex = 0; threadsPassIndex < 3; threadsPassIndex++)
3172:     if (threadsPassIndex != 0)
3178:     if (threadsPassIndex != 0)
3183:       if (threadsPassIndex == 1)
3199:   if (threadsPassIndex > 0)
3229:   PrintRequirements(f, "usage:", true, GetBenchMemoryUsage(numThreads, dict, totalBenchMode), "Benchmark threads:   ", numThreads);
1064:       RINOK(setCoderMt->SetNumberOfThreads(NumDecoderSubThreads));
1171:         numThreads
1195:   UInt32 numEncoderThreads = 1;
1196:   UInt32 numSubDecoderThreads = 1;
1199:     numEncoderThreads = numThreads;
1203:       if (numThreads == 1 && method.Get_NumThreads() < 0)
1204:         method.AddProp_NumThreads(1);
1205:       const UInt32 numLzmaThreads = method.Get_Lzma_NumThreads();
1206:       if (numThreads > 1 && numLzmaThreads > 1)
1208:         numEncoderThreads = numThreads / 2;
1209:         numSubDecoderThreads = 2;
1214:   CBenchEncoders encodersSpec(numEncoderThreads);
1219:   for (i = 0; i < numEncoderThreads; i++)
1240:     for (UInt32 j = 0; j < numSubDecoderThreads; j++)
1258:   for (i = 0; i < numEncoderThreads; i++)
1274:   for (i = 0; i < numEncoderThreads; i++)
1291:       bpi->BenchInfo.NumIterations = numEncoderThreads;
1296:     if (numEncoderThreads > 1)
1312:   if (numEncoderThreads > 1)
1313:     for (i = 0; i < numEncoderThreads; i++)
1326:   for (i = 0; i < numEncoderThreads; i++)
1339:   UInt32 numDecoderThreads = numEncoderThreads * numSubDecoderThreads;
1341:   for (i = 0; i < numEncoderThreads; i++)
1350:       bpi->BenchInfo.NumIterations = numDecoderThreads;
1358:       int numSubThreads = method.Get_NumThreads();
1359:       encoder.NumDecoderSubThreads = (numSubThreads <= 0) ? 1 : numSubThreads;
1361:     if (numDecoderThreads > 1)
1363:       for (UInt32 j = 0; j < numSubDecoderThreads; j++)
1367:             , ((i * numSubDecoderThreads + j) * 16 * 21) & 0x7FF
1382:   if (numDecoderThreads > 1)
1383:     for (i = 0; i < numEncoderThreads; i++)
1384:       for (UInt32 j = 0; j < numSubDecoderThreads; j++)
1399:   if (numDecoderThreads > 1)
1400:     for (i = 0; i < numEncoderThreads; i++)
1401:       for (UInt32 j = 0; j < numSubDecoderThreads; j++)
1412:   info.NumIterations = numSubDecoderThreads * encoders[0].NumIterations;
1414:   for (i = 0; i < numEncoderThreads; i++)
1444: UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary, bool totalBench)
1448:   bool lzmaMt = (totalBench || numThreads > 1);
1449:   UInt32 numBigThreads = numThreads;
1451:     numBigThreads /= 2;
1453:     GetLZMAUsage(lzmaMt, dictionary) + (2 << 20)) * numBigThreads;
1551:     for (UInt32 i = 0; i < NumThreads; i++)
1553:     NumThreads = 0;
1609:     for (UInt32 i = 0; i < NumThreads; i++)
1611:     NumThreads = 0;
1871:   // s.Add_UInt32(ti.numProcessThreads);
1874:     // if (ti.numProcessThreads != ti.numSysThreads)
1877:       s.Add_UInt32(ti.GetNumSystemThreads());
1905:   PrintNumber(f, numThreads, 3);
2019:     UInt32 numThreads,
2048:         false, numThreads, method,
2073:     UInt32 numThreads,
2085:   if (numThreads == 0)
2086:     numThreads = 1;
2089:   numThreads = 1;
2101:   if (numThreads > 1)
2105:     for (i = 0; i < numThreads; i++)
2114:     for (i = 0; i < numThreads; i++)
2121:     for (i = 0; i < numThreads; i++)
2149:       UInt64 numCommands = (UInt64)numIterations * bufferSize * numThreads * complexity;
2151:       cpuFreq = rating / numThreads;
2168:     UInt32 numThreads, UInt32 bufferSize,
2177:   if (numThreads == 0)
2178:     numThreads = 1;
2181:   numThreads = 1;
2193:   size_t totalSize = (size_t)bufferSize * numThreads;
2194:   if (totalSize / numThreads != bufferSize)
2210:   if (numThreads > 1)
2215:     for (i = 0; i < numThreads; i++)
2250:     for (i = 0; i < numThreads; i++)
2257:     for (i = 0; i < numThreads; i++)
2286:   UInt64 unpSizeThreads = unpSize * numThreads;
2287:   info.UnpackSize = unpSizeThreads;
2288:   info.PackSize = unpSizeThreads;
2294:       UInt64 numCommands = unpSizeThreads * complexity / 256;
2303:   speed = info.GetSpeed(unpSizeThreads);
2311:     UInt32 numThreads, UInt32 bufSize,
2333:         numThreads, bufSize,
2376:   return (num <= numThreads) ? num : numThreads;
2784:   UInt32 numThreadsSpecified = numCPUs;
2790:   bool multiThreadTests = false;
2874:         multiThreadTests = true;
2878:       RINOK(ParseMtProp(s, propVariant, numCPUs, numThreadsSpecified));
3015:   if (numThreadsSpecified < 1 || numThreadsSpecified > kNumThreadsMax)
3033:         true, numThreadsSpecified,
3091:     unsigned numThreadsTests = 0;
3094:       UInt32 t = GetNumThreadsNext(numThreadsTests, numThreadsSpecified);
3096:       numThreadsTests++;
3097:       if (t >= numThreadsSpecified)
3102:     CTempValues speedTotals(numThreadsTests);
3104:       for (unsigned ti = 0; ti < numThreadsTests; ti++)
3124:         for (unsigned ti = 0; ti < numThreadsTests; ti++)
3127:           UInt32 t = GetNumThreadsNext(ti, numThreadsSpecified);
3145:       for (unsigned ti = 0; ti < numThreadsTests; ti++)
3168:   UInt32 numThreads = numThreadsSpecified;
3170:   if (!multiThreadTests)
3177:     numThreads = 1;
3182:       numThreads = numCPUs;
3186:           numThreads = numCPUs / 2;
3216:       if (GetBenchMemoryUsage(numThreads, ((UInt32)1 << dicSizeLog), totalBenchMode) + (8 << 20) <= ramSize)
3327:         RINOK(FreqBench(complexInCommands, numThreads, printCallback,
3346:             complexInCommands, numThreads,
3354:       res = TotalBench_Hash(EXTERNAL_CODECS_LOC_VARS complexInCommands, numThreads,
3363:         RINOK(FreqBench(complexInCommands, numThreads, printCallback,
3453:           true, numThreads,
android.googlesource.com/platform/external/pthreads:implement.h: [ master, ] c++
130:   DWORD thread;
444:   ptw32_thread_t * thread;
131:   HANDLE threadH;		/* Win32 thread handle - POSIX thread is invalid if threadH == 0 */
139:   pthread_mutex_t threadLock;	/* Used for serialised access to public thread state */
210:   pthread_t ownerThread;
271:   void *threads;
275: typedef struct ThreadParms ThreadParms;
276: typedef struct ThreadKeyAssoc ThreadKeyAssoc;
278: struct ThreadParms
344: struct ThreadKeyAssoc
447:   ThreadKeyAssoc *nextThread;
449:   ThreadKeyAssoc *prevThread;
123: typedef struct ptw32_thread_t_ ptw32_thread_t;
125: struct ptw32_thread_t_
522: #define PTW32_THREAD_REUSE_EMPTY ((ptw32_thread_t *) 1)
162: struct pthread_attr_t_
198: struct pthread_mutex_t_
215: struct pthread_mutexattr_t_
242: struct pthread_spinlock_t_
252: struct pthread_barrier_t_
261: struct pthread_barrierattr_t_
266: struct pthread_key_t_
286: struct pthread_cond_t_
304: struct pthread_condattr_t_
311: struct pthread_rwlock_t_
322: struct pthread_rwlockattr_t_
108:   PThreadStateInitial = 0,	/* Thread not running                   */
109:   PThreadStateRunning,		/* Thread alive & kicking               */
110:   PThreadStateSuspended,	/* Thread alive but suspended           */
111:   PThreadStateCancelPending,	/* Thread alive but is                  */
113:   PThreadStateCanceling,	/* Thread alive but is                  */
116:   PThreadStateException,	/* Thread alive but exiting             */
118:   PThreadStateLast
120: PThreadState;
709: #define _endthreadex ExitThread
104:    * This enumeration represents the state of the thread;
105:    * The thread is still "alive" if the numeric value of the
132:   pthread_t ptHandle;		/* This thread's permanent pthread_t handle */
133:   ptw32_thread_t * prevReuse;	/* Links threads on reuse stack */
206:   int recursive_count;		/* Number of unlocks a thread needs to perform
348:    *      This structure creates an association between a thread and a key.
350:    *      destroy routine for thread specific data registered by a user upon
351:    *      exiting a thread.
357:    *         T - Thread that has called pthread_setspecific(Kn)
358:    *            (head of chain is thread->keys)
377:    *      general lock (guarding the row) and the thread's general
381:    *      be released - both the key must be deleted and the thread
383:    *      allows the resources to be freed as soon as either thread or
387:    *      and thread locks are always acquired in the order: key lock
388:    *      then thread lock. An exception to this exists when a thread
392:    *      An association is created when a thread first calls
397:    *      thread calls the key destructor function on thread exit, or
401:    *      thread
402:    *              reference to the thread that owns the
404:    *              thread struct itself. Since the association is
405:    *              destroyed before the thread exits, this can never
406:    *              point to a different logical thread to the one that
407:    *              created the assoc, i.e. after thread struct reuse.
434:    *      1)      As soon as either the key or the thread is no longer
521: /* Thread Reuse stack bottom marker. Must not be NULL or any valid pointer to memory. */
525: extern ptw32_thread_t * ptw32_threadReuseTop;
526: extern ptw32_thread_t * ptw32_threadReuseBottom;
540: extern CRITICAL_SECTION ptw32_thread_reuse_lock;
595:   void ptw32_threadReusePush (pthread_t thread);
599:   int ptw32_setthreadpriority (pthread_t thread, int policy, int priority);
610:   void ptw32_callUserDestroyRoutines (pthread_t thread);
612:   int ptw32_tkAssocCreate (ptw32_thread_t * thread, pthread_key_t key);
6:  * Keeps all the internals out of pthread.h
10:  *      Pthreads-win32 - POSIX Threads Library for Win32
141:   pthread_mutex_t cancelLock;	/* Used for async-cancel safety */
188:   pthread_mutex_t lock;
212: 				   threads. */
248:     pthread_mutex_t mutex;	/* mutex if single cpu.            */
270:   pthread_mutex_t keyLock;
280:   pthread_t tid;
288:   long nWaitersBlocked;		/* Number of threads blocked            */
289:   long nWaitersGone;		/* Number of threads timed out          */
290:   long nWaitersToUnblock;	/* Number of threads to unblock         */
291:   sem_t semBlockQueue;		/* Queue up threads waiting for the     */
296:   pthread_mutex_t mtxUnblockLock;	/* Mutex that guards access to          */
299:   pthread_cond_t next;		/* Doubly linked list                   */
300:   pthread_cond_t prev;
313:   pthread_mutex_t mtxExclusiveAccess;
314:   pthread_mutex_t mtxSharedAccessCompleted;
315:   pthread_cond_t cndSharedAccessCompleted;
356:    *            (head of chain is key->threads)
393:    *      pthread_setspecific() on a key that has a specified
413:    *              The pthread_t->keys attribute is the head of a
416:    *              between a pthread_t and all pthread_key_t on which
417:    *              it called pthread_setspecific.
422:    *      nextThread
423:    *              The pthread_key_t->threads attribute is the head of
426:    *              relationship between a pthread_key_t and all the 
427:    *              PThreads that have called pthread_setspecific for
428:    *              this pthread_key_t.
430:    *      prevThread
439:    *              pthread_setspecific if the user provided a
445:   pthread_key_t key;
446:   ThreadKeyAssoc *nextKey;
448:   ThreadKeyAssoc *prevKey;
518: /* Declared in pthread_cancel.c */
527: extern pthread_key_t ptw32_selfThreadKey;
528: extern pthread_key_t ptw32_cleanupKey;
529: extern pthread_cond_t ptw32_cond_list_head;
530: extern pthread_cond_t ptw32_cond_list_tail;
548: extern int pthread_count;
564:   int ptw32_is_attr (const pthread_attr_t * attr);
566:   int ptw32_cond_check_need_init (pthread_cond_t * cond);
567:   int ptw32_mutex_check_need_init (pthread_mutex_t * mutex);
568:   int ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock);
581: 			       HANDLE threadH, DWORD callback_arg);
587:   void ptw32_threadDestroy (pthread_t tid);
591:   pthread_t ptw32_new (void);
593:   pthread_t ptw32_threadReusePop (void);
608:     ptw32_threadStart (void *vthreadParms);
614:   void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc);
649:   _CRTIMP unsigned long __cdecl _beginthread (void (__cdecl *) (void *),
651:   _CRTIMP void __cdecl _endthread (void);
689: #if defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(NEED_CREATETHREAD)
692:  * Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE
702:         CreateThread(security, \
704:                      (LPTHREAD_START_ROUTINE) start_proc, \
711: #endif				/* __CYGWIN32__ || __CYGWIN__ || NEED_CREATETHREAD */
12:  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
20:  *      http://sources.redhat.com/pthreads-win32/contributors.html
106:    * state is greater or equal "PThreadStateRunning".
134:   volatile PThreadState state;
425:    *              nextThreads link. This chain provides the 1 to many
652:   _CRTIMP unsigned long __cdecl _beginthreadex (void *, unsigned,
655:   _CRTIMP void __cdecl _endthreadex (unsigned);
685:  * Question 1 - How do I get pthreads-win32 to link under Cygwin or Mingw32?
696: #define _beginthreadex(security, \
chromium.googlesource.com/chromium/deps/psyco_win32:psyco/profiler.py: [ master, ] python
20:     import dummy_thread as thread
365: def psyco_start_new_thread(callable, args, kw=None):
371: original_start_new_thread = thread.start_new_thread
358: def psyco_thread_stub(callable, args, kw):
18:     import thread
32: # a lock for a thread-safe go()
33: go_lock = thread.allocate_lock()
260:         self.lock = thread.allocate_lock()
343: # and thread.start_new_thread().
366:     "This is the Psyco-aware version of thread.start_new_thread()."
367:     return original_start_new_thread(psyco_thread_stub, (callable, args, kw))
374: thread.start_new_thread = psyco_start_new_thread
375: # hack to patch threading._start_new_thread if the module is
378:     hasattr(sys.modules['threading'], '_start_new_thread')):
379:     sys.modules['threading']._start_new_thread = psyco_start_new_thread
204:             alarm.stop(1)   # wait for parallel threads to stop
377: if ('threading' in sys.modules and
android.googlesource.com/platform/external/perfetto:protos/perfetto/trace/perfetto_trace.proto: [ master, ] protobuf
398:   message Thread {
462:   optional int32 to_thread = 4;
424:     repeated Thread threads_deprecated = 4 [deprecated = true];
435:   repeated Thread threads = 2;
397:   // Representation of a thread.
399:     // The thread id (as per gettid())
402:     // Thread group id (i.e. the PID of the process, == TID of the main thread)
405:     // The name of the thread.
411:     // The UNIX process ID, aka thread group ID (as per getpid()).
418:     // If it is a kernel thread there will only be one cmdline field
429:   // different ProcessTree messages. A thread might event not show up at all, if
422:     // No longer used as of Apr 2018, when the dedicated |threads| field was
427:   // List of processes and threads in the client. These lists are incremental
428:   // and not exhaustive. A process and its threads might show up separately in
431:   // #0 { processes: [{pid: 10, ...}], threads: [{pid: 11, tgid: 10}] }
432:   // #1 { threads: [{pid: 12, tgid: 10}] }
433:   // #2 { processes: [{pid: 20, ...}], threads: [{pid: 13, tgid: 10}] }
chromium.googlesource.com/chromium/src/sandbox:win/src/nt_internals.h: [ master, ] c++ Duplicate result
android.googlesource.com/platform/external/libchrome:base/debug/activity_tracker.h: [ master, ] c++
119:   } thread;
118:     int64_t thread_id;  // A unique identifier for a thread within a process.
279:     ACT_THREAD = 4 << 4,
594:     std::string thread_name;
604:     int64_t thread_id = 0;
745:   base::ThreadChecker thread_checker_;
1181:   std::atomic<int> thread_tracker_count_;
1184:   ActivityTrackerMemoryAllocator thread_tracker_allocator_;
1185:   base::Lock thread_tracker_allocator_lock_;
160:   static ActivityData ForThread(const int64_t id) {
574: class BASE_EXPORT ThreadActivityTracker {
927:   ThreadActivityTracker* GetTrackerForCurrentThread() {
934:   ThreadActivityTracker* GetOrCreateTrackerForCurrentThread() {
1055:   class ThreadSafeUserData : public ActivityUserData {
280:     ACT_THREAD_START = ACT_THREAD,
281:     ACT_THREAD_JOIN,
1178:   base::ThreadLocalStorage::Slot this_thread_tracker_;
832:   class BASE_EXPORT ScopedThreadActivity
1047:     kMaxThreadCount = 100,
1048:     kCachedThreadMemories = 10,
1316: class BASE_EXPORT ScopedThreadJoinActivity
1320:   explicit ScopedThreadJoinActivity(const base::PlatformThreadHandle* thread)
35: #include "base/threading/platform_thread.h"
36: #include "base/threading/thread_checker.h"
37: #include "base/threading/thread_local_storage.h"
162:     data.thread.thread_id = id;
184: // persistent memory allocator. Instances of this class are NOT thread-safe.
185: // Use from a single thread or protect access with a lock.
263:     // Task activities involve callbacks posted to a thread or thread-pool
278:     // Thread activities involve the life management of threads.
309:   // from a completely different thread though most activities will leave
345: // done by a thread by supporting key/value pairs of any type. This can provide
347: // global data. All updates must be done from the same thread though other
411:   // contents have been overwritten by another thread. The return value is
537:   // gone away (cleared by another thread/process), it will invalidate all the
565: // This class manages tracking a stack of activities for a single thread in
568: // thread is analyzing this data in real-time, atomic operations are used
578:   // This structure contains all the common information about the thread so
585:   // so that continued operation of the thread will not cause changes here.
592:     // The name of the thread as set when it was created. The name may be
599:     // The process and thread IDs. These values have no meaning other than
600:     // they uniquely identify a running process and a running thread within
601:     // that process.  Thread-IDs can be re-used across different processes
602:     // and both can be re-used after the process/thread exits.
606:     // The current stack of activities that are underway for this thread. It
635:     // The thread tracker to which this object reports. It can be null if
751: // The global tracker manages all the individual thread trackers. Memory for
752: // the thread trackers is taken from a PersistentMemoryAllocator which allows
828:   // This is a thin wrapper around the thread-tracker's ScopedActivity that
830:   // which thread-tracker to use. It is safe to create even if activity
846:     // Gets (or creates) a tracker for the current thread. If locking is not
849:     // the tracker for this thread has been created for other reasons, locks
850:     // will be tracked. The thread-tracker uses locks.
870:   // providing the given |stack_depth| to each thread tracker it manages. The
911:   // calling this. Tracking for the current thread will be automatically
923:   // Gets the thread's activity-tracker if it exists. This is inline for
924:   // performance reasons and it uses thread-local-storage (TLS) so that there
926:   // thread. Ownership remains with the global tracker.
928:     return reinterpret_cast<ThreadActivityTracker*>(this_thread_tracker_.Get());
931:   // Gets the thread's activity-tracker or creates one if none exists. This
941:   // Creates an activity-tracker for the current thread.
944:   // Releases the activity-tracker for the current thread (for testing only).
1009:   // Record field trial information. This call is thread-safe. In addition to
1020:   // Record exception information for the current thread.
1032:   // Updates to this are thread-safe.
1036:   // Updates to this are thread-safe.
1052:   // A wrapper around ActivityUserData that is thread-safe and thus can be used
1054:   // thread.
1118:   // A thin wrapper around the main thread-tracker that keeps additional
1127:     // The reference into persistent memory from which the thread-tracker's
1131:     // The physical address used for the thread-tracker's memory.
1139:   // providing the given |stack_depth| to each thread tracker it manages. The
1154:   // Releases the activity-tracker associcated with thread. It is called
1155:   // automatically when a thread is joined and thus there is nothing more to
1159:   // Does process-exit work. This can be run on any thread.
1177:   // The activity tracker for the currently executing thread.
1180:   // The number of thread trackers currently active.
1183:   // A caching memory allocator for thread-tracker objects.
1191:   // An object for holding arbitrary key value pairs with thread-safe access.
1213:   // the |background_task_runner_| if one is set or whatever thread reaped
1322:                                  thread) {}
1326:                            const base::PlatformThreadHandle* thread);
9: // what all the various threads and processes are (or were) doing.
51: class ThreadActivityTracker;
159:   static ActivityData ForThread(const PlatformThreadHandle& handle);
348: // threads can read it concurrently if they create new objects using the same
624:     ScopedActivity(ThreadActivityTracker* tracker,
637:     ThreadActivityTracker* const tracker_;
646:   // A ThreadActivityTracker runs on top of memory that is managed externally.
649:   ThreadActivityTracker(void* base, size_t size);
650:   virtual ~ThreadActivityTracker();
747:   DISALLOW_COPY_AND_ASSIGN(ThreadActivityTracker);
833:       : public ThreadActivityTracker::ScopedActivity {
851:     static ThreadActivityTracker* GetOrCreateTracker(bool lock_allowed) {
856:         return global_tracker->GetOrCreateTrackerForCurrentThread();
858:         return global_tracker->GetTrackerForCurrentThread();
910:   // the global tracker completely. All tracked threads must exit before
935:     ThreadActivityTracker* tracker = GetTrackerForCurrentThread();
938:     return CreateTrackerForCurrentThread();
942:   ThreadActivityTracker* CreateTrackerForCurrentThread();
1045:     // The maximum number of threads that can be tracked within a process. If
1057:     ThreadSafeUserData(void* memory, size_t size, int64_t pid = 0);
1058:     ~ThreadSafeUserData() override;
1068:     DISALLOW_COPY_AND_ASSIGN(ThreadSafeUserData);
1119:   // information that the global tracker needs to handle joined threads.
1120:   class ManagedActivityTracker : public ThreadActivityTracker {
1169:   // The size (in bytes) of memory required by a ThreadActivityTracker to
1192:   ThreadSafeUserData process_data_;
1193:   ThreadSafeUserData global_data_;
45: class PlatformThreadHandle;
835:     ScopedThreadActivity(const void* program_counter,
840:     ~ScopedThreadActivity();
864:     DISALLOW_COPY_AND_ASSIGN(ScopedThreadActivity);
945:   void ReleaseTrackerForCurrentThreadForTesting();
1041:   friend class ScopedThreadActivity;
1223:     : public GlobalActivityTracker::ScopedThreadActivity {
1275:     : public GlobalActivityTracker::ScopedThreadActivity {
1289:     : public GlobalActivityTracker::ScopedThreadActivity {
1303:     : public GlobalActivityTracker::ScopedThreadActivity {
1317:     : public GlobalActivityTracker::ScopedThreadActivity {
1321:       : ScopedThreadJoinActivity(::tracked_objects::GetProgramCounter(),
1325:   ScopedThreadJoinActivity(const void* program_counter,
1327:   DISALLOW_COPY_AND_ASSIGN(ScopedThreadJoinActivity);
1333:     : public GlobalActivityTracker::ScopedThreadActivity {
chromium.googlesource.com/arc/arc:third_party/chromium-ppapi/sandbox/win/src/nt_internals.h: [ master, ] c++ Duplicate result
chromium.googlesource.com/chromium/codesearch:src/sandbox/win/src/nt_internals.h: [ master, ] c++ Duplicate result
chromium.googlesource.com/ios-chromium-mirror:sandbox/win/src/nt_internals.h: [ master, ] c++ Duplicate result
chromium.googlesource.com/chromium/src:sandbox/win/src/nt_internals.h: [ master, ] c++ Duplicate result
chromium.googlesource.com/chromium/codesearch:src/third_party/abseil-cpp/absl/synchronization/mutex.cc: [ master, ] c++
462:   PerThreadSynch *const thread;  // thread that is waiting
500: static PerThreadSynch *Synch_GetPerThread() {
488: static PerThreadSynch *const kPerThreadSynchNull =
505: static PerThreadSynch *Synch_GetPerThreadAnnotated(Mutex *mu) {
739: static inline PerThreadSynch *GetPerThreadSynch(intptr_t v) {
39: #include <thread>  // NOLINT(build/c++11)
50: #include "absl/base/internal/thread_identity.h"
54: #include "absl/synchronization/internal/per_thread_sem.h"
68: ABSL_ATTRIBUTE_WEAK void AbslInternalMutexYield() { std::this_thread::yield(); }
75: #if defined(THREAD_SANITIZER)
144:   // any thread to make progress gets it without undue delay.
427: // The SynchWaitParams struct encapsulates the way in which a thread is waiting:
430: // type of lock).  It also points to the PerThreadSynch struct of its thread.
434: // PerThreadSynch because a thread can be waiting on multiple Mutexes if,
440: // the thread is on a Mutex's waiter queue.
444:                   PerThreadSynch *thread_arg,
450:         thread(thread_arg),
454:   const Mutex::MuHow how;  // How this thread needs to wait.
455:   const Condition *cond;  // The condition that this thread is waiting for.
464:   // If not null, thread should be enqueued on the CondVar whose state
468:   int64_t contention_start_cycles;  // Time (in cycles) when this thread started
480:   // If a thread overfills the array during deadlock detection, we
483:   // detecting when a thread releases a lock it does not hold.
499: // Return the PerThreadSynch-struct for this thread.
502:   return &identity->per_thread_synch;
529:   PerThreadSem::Post(w->thread_identity());
556:   // Fix the per-thread state only if it exists.
559:     identity->per_thread_synch.suppress_fatal_errors = true;
596: // INVARIANT1:  there's a thread that was blocked on the mutex, is
601: // set when a thread is unblocked(INV1a), and threads that were
683: #ifdef THREAD_SANITIZER
743: // The next several routines maintain the per-thread next and skip fields
748: //   For thread x, x->skip is one of:
751: //     - a pointer to a distinct thread waiting later in the same Mutex queue
757: // first runnable thread y from the front a Mutex queue to adjust the skip
758: // field of another thread x because if x->skip==y, x->skip must (have) become
760: // thread from an arbitrary position in the queue whether runnable or not, so
769: // Returns the last thread y in a mutex waiter queue such that all threads in
772: // the range.  Requires thread x is in a mutex waiter queue.
830: // Enqueue thread "waitp->thread" on a waiter queue.
836: // If waitp->cv_word == nullptr, queue the thread at either the front or
842: // whether this thread was transferred from a CondVar or is waiting for a
846: // returned. This mechanism is used by CondVar to queue a thread on the
858:   PerThreadSynch *s = waitp->thread;
879:       // Every so often, update our idea of the thread's priority.
964: // Dequeue the successor pw->next of thread pw from the Mutex waiter queue
1027: // Try to remove thread s from the list of waiters on this mutex.
1040:       if ((w = pw->next) != s) {  // search for thread,
1051:           // don't search further if we found the thread, or we're about to
1052:           // process the first thread again.
1055:       if (w == s) {                 // found thread; remove it
1078: // Wait until thread "s", which must be the current thread, is removed from the
1111: // Wake thread w, and return the next thread in the list.
1162: // eventually followed by a call to LockLeave(mu, id, x) by the same thread.
1182:                      "thread releasing lock it does not hold: %p %s; "
1282: // Called in debug mode when a thread is about to acquire a lock in a way that
1299:     // it can't always be the first lock acquired by a thread.
1303:   // We prefer to keep stack traces that show a thread holding and acquiring
1309:   // For each other mutex already held by this thread:
1402:         ABSL_RAW_LOG(FATAL, "thread should not hold mutex %p %s",
1551:   this->Block(waitp.thread);
1708: // the mutex if this thread has blocked, and therefore may be the designated
1774: // addition and this thread. So if we would enable race detection here,
1823:     this->Block(waitp.thread);
1872:       waitp->thread->waitp == nullptr || waitp->thread->suppress_fatal_errors,
1888:         this->Block(waitp->thread);
1895:         // This thread tries to become the one and only waiter.
1909:           waitp->thread->waitp = nullptr;
1931:           this->Block(waitp->thread);
1956:         this->Block(waitp->thread);  // wait until removed from list or timeout
1962:         waitp->thread->waitp == nullptr || waitp->thread->suppress_fatal_errors,
1967:       waitp->thread->waitp == nullptr || waitp->thread->suppress_fatal_errors,
1976: // Unlock this mutex, which is held by the current thread.
1977: // If waitp is non-zero, it must be the wait parameters for the current thread
2002:   ABSL_RAW_CHECK(waitp == nullptr || waitp->thread->waitp == nullptr ||
2003:                      waitp->thread->suppress_fatal_errors,
2006:   // the list of waiters.  In addition, it places waitp.thread on the queue of
2187:                // this thread's condition is not known false, AND
2281: // waiting thread may have been moved from the condition variable queue to the
2282: // mutex queue without a wakeup, by Trans().  In that case, when the thread is
2283: // finally woken, the woken thread will believe it has been woken from the
2292: // Used by CondVar implementation to effectively wake thread w from the
2293: // condition variable.  If this mutex is free, we simply wake the thread.
2295: // enqueue thread w on this mutex.
2309:     // conflicting != 0 implies that the waking thread cannot currently take
2321:         // This thread tries to become the one and only waiter.
2353:     ABSL_RAW_LOG(FATAL, "thread should hold write lock on Mutex %p %s",
2363:         FATAL, "thread should hold at least a read lock on Mutex %p %s",
2393: // Remove thread s from the list of waiters on this condition variable.
2406:         while (w->next != s && w->next != h) {  // search for thread
2409:         if (w->next == s) {           // found thread; remove it
2428: // Queue thread waitp->thread on condition variable word cv_word using
2434: // to block this thread.  That would be a problem if the thread were already on
2436: // to tell the unlock code to call CondVarEnqueue() to queue the thread on the
2441:   // This thread might be transferred to the Mutex queue by Fer() when
2446:   // this thread on another queue.
2459:   ABSL_RAW_CHECK(waitp->thread->waitp == nullptr, "waiting when shouldn't be");
2460:   waitp->thread->waitp = waitp;      // prepare ourselves for waiting
2462:   if (h == nullptr) {  // add this thread to waiter list
2463:     waitp->thread->next = waitp->thread;
2465:     waitp->thread->next = h->next;
2466:     h->next = waitp->thread;
2468:   waitp->thread->state.store(PerThreadSynch::kQueued,
2470:   cv_word->store((v & kCvEvent) | reinterpret_cast<intptr_t>(waitp->thread),
2492:   // Mutex, thus queuing this thread on the condition variable.  See
2497:   while (waitp.thread->state.load(std::memory_order_acquire) ==
2499:     if (!Mutex::DecrementSynchSem(mutex, waitp.thread, t)) {
2500:       this->Remove(waitp.thread);
2505:   ABSL_RAW_CHECK(waitp.thread->waitp != nullptr, "not waiting when should be");
2506:   waitp.thread->waitp = nullptr;  // cleanup
2537: // Wake thread w
2543:     // The waiting thread only needs to observe "w->state == kAvailable" to be
2611:         do {                          // for every thread, wake it up
2637: #ifdef THREAD_SANITIZER
24: #include <pthread.h>
59: using absl::base_internal::ThreadIdentity;
501:   ThreadIdentity *identity = GetOrCreateCurrentThreadIdentity();
509:   PerThreadSynch *w = Synch_GetPerThread();
517:   PerThreadSynch *s = Synch_GetPerThread();
540:   assert(w == Synch_GetPerThread());
557:   ThreadIdentity *identity = CurrentThreadIdentityIfPresent();
593: static const intptr_t kMuWait        = 0x0004L;  // threads are waiting
598: // designated waker, all threads can avoid taking the slow path in
729: // Return true iff threads x and y are waiting on the same condition for the
752: //       such that all threads in [x, x->skip] have the same condition and
770: // [x, y] inclusive share the same condition.  Sets skip fields of some threads
876: #ifdef ABSL_HAVE_PTHREAD_GETSCHEDPARAM
880:       // pthread_getschedparam() is 5% of the block/wakeup time;
884:       pthread_getschedparam(pthread_self(), &policy, &param);
1045:             // in the threads we skipped; none can point to s
1998:   PerThreadSynch *wake_list = kPerThreadSynchNull;   // list of threads to wake
2005:   // This loop finds threads wake_list to wakeup if any, and removes them from
2645:   // ThreadSanitizer does not instrument this file for memory accesses.
57: using absl::base_internal::CurrentThreadIdentityIfPresent;
58: using absl::base_internal::PerThreadSynch;
60: using absl::synchronization_internal::GetOrCreateCurrentThreadIdentity;
65: using absl::synchronization_internal::PerThreadSem;
439: // PerThreadSynch struct points at the most recent SynchWaitParams struct when
489:   reinterpret_cast<PerThreadSynch *>(1);
519:     s->all_locks = LocksHeldAlloc();  // Freed by ReclaimThreadIdentity.
524: // Post on "w"'s associated PerThreadSem.
525: inline void Mutex::IncrementSynchSem(Mutex *mu, PerThreadSynch *w) {
535: // Wait on "w"'s associated PerThreadSem; returns false if timeout expired.
536: bool Mutex::DecrementSynchSem(Mutex *mu, PerThreadSynch *w, KernelTimeout t) {
542:   bool res = PerThreadSem::Wait(t);
569: // PerThreadSem::Wait() for consistency.  Unfortunately, we don't have
627: // PerThreadSynch::readers of the most recently queued waiter, again in the
635: static_assert(PerThreadSynch::kAlignment > kMuLow,
636:               "PerThreadSynch::kAlignment must be greater than kMuLow");
732: static bool MuSameCondition(PerThreadSynch *x, PerThreadSynch *y) {
737: // Given the contents of a mutex word containing a PerThreadSynch pointer,
740:   return reinterpret_cast<PerThreadSynch *>(v & kMuHigh);
797: static PerThreadSynch *Skip(PerThreadSynch *x) {
798:   PerThreadSynch *x0 = nullptr;
799:   PerThreadSynch *x1 = x;
800:   PerThreadSynch *x2 = x->skip;
816: static void FixSkip(PerThreadSynch *ancestor, PerThreadSynch *to_be_removed) {
849: static PerThreadSynch *Enqueue(PerThreadSynch *head,
875:     PerThreadSynch *enqueue_after = nullptr;  // we'll put s after this element
897:         PerThreadSynch *advance_to = head;    // next value of enqueue_after
898:         PerThreadSynch *cur;                  // successor of enqueue_after
960:   s->state.store(PerThreadSynch::kQueued, std::memory_order_relaxed);
968: static PerThreadSynch *Dequeue(PerThreadSynch *head, PerThreadSynch *pw) {
969:   PerThreadSynch *w = pw->next;
991: static PerThreadSynch *DequeueAllWakeable(PerThreadSynch *head,
992:                                           PerThreadSynch *pw,
993:                                           PerThreadSynch **wake_tail) {
994:   PerThreadSynch *orig_h = head;
995:   PerThreadSynch *w = pw->next;
1029: void Mutex::TryRemove(PerThreadSynch *s) {
1036:     PerThreadSynch *h = GetPerThreadSynch(v);
1038:       PerThreadSynch *pw = h;   // pw is w's predecessor
1039:       PerThreadSynch *w;
1060:         s->state.store(PerThreadSynch::kAvailable, std::memory_order_release);
1083: void Mutex::Block(PerThreadSynch *s) {
1084:   while (s->state.load(std::memory_order_acquire) == PerThreadSynch::kQueued) {
1112: PerThreadSynch *Mutex::Wakeup(PerThreadSynch *w) {
1113:   PerThreadSynch *next = w->next;
1115:   w->state.store(PerThreadSynch::kAvailable, std::memory_order_release);
1544:       how, &cond, t, nullptr /*no cvmu*/, Synch_GetPerThreadAnnotated(this),
1816:       how, cond, t, nullptr /*no cvmu*/, Synch_GetPerThreadAnnotated(this),
1896:         PerThreadSynch *new_h = Enqueue(nullptr, waitp, v, flags);
1919:           PerThreadSynch *h = GetPerThreadSynch(v);
1940:         PerThreadSynch *h = GetPerThreadSynch(v);
1941:         PerThreadSynch *new_h = Enqueue(h, waitp, v, flags);
1991:   PerThreadSynch *w = nullptr;
1993:   PerThreadSynch *pw = nullptr;
1995:   PerThreadSynch *old_h = nullptr;
2039:           PerThreadSynch *new_h = nullptr;
2071:       PerThreadSynch *h = GetPerThreadSynch(v);
2077:           PerThreadSynch *new_h = Enqueue(h, waitp, v, kMuIsCond);
2134:             PerThreadSynch *new_h = Enqueue(h, waitp, v, kMuIsCond);
2148:         PerThreadSynch *w_walk;   // current waiter during list walk
2149:         PerThreadSynch *pw_walk;  // previous waiter during list walk
2244:       ABSL_RAW_CHECK(wake_list != kPerThreadSynchNull,
2261:   if (wake_list != kPerThreadSynchNull) {
2266:     } while (wake_list != kPerThreadSynchNull);
2296: void Mutex::Fer(PerThreadSynch *w) {
2316:       w->state.store(PerThreadSynch::kAvailable, std::memory_order_release);
2322:         PerThreadSynch *new_h = Enqueue(nullptr, w->waitp, v, kMuIsCond);
2332:         PerThreadSynch *h = GetPerThreadSynch(v);
2333:         PerThreadSynch *new_h = Enqueue(h, w->waitp, v, kMuIsCond);
2377: static_assert(PerThreadSynch::kAlignment > kCvLow,
2378:               "PerThreadSynch::kAlignment must be greater than kCvLow");
2394: void CondVar::Remove(PerThreadSynch *s) {
2403:       PerThreadSynch *h = reinterpret_cast<PerThreadSynch *>(v & ~kCvLow);
2405:         PerThreadSynch *w = h;
2415:           s->state.store(PerThreadSynch::kAvailable, std::memory_order_release);
2461:   PerThreadSynch *h = reinterpret_cast<PerThreadSynch *>(v & ~kCvLow);
2490:                         Synch_GetPerThreadAnnotated(mutex), &cv_);
2498:          PerThreadSynch::kQueued) {
2541: void CondVar::Wakeup(PerThreadSynch *w) {
2547:     w->state.store(PerThreadSynch::kAvailable, std::memory_order_release);
2564:       PerThreadSynch *h = reinterpret_cast<PerThreadSynch *>(v & ~kCvLow);
2565:       PerThreadSynch *w = nullptr;
2607:       PerThreadSynch *h = reinterpret_cast<PerThreadSynch *>(v & ~kCvLow);
2609:         PerThreadSynch *w;
2610:         PerThreadSynch *n = h->next;
github.com/google/gapid:gapis/service/service.proto: [ master, ] protobuf
623: message Thread {
76: message Threads { repeated path.Thread list = 1; }
95:     Thread thread = 16;
622: // Thread represents a single thread in the capture.
96:     Threads threads = 17;
chromium.googlesource.com/ios-chromium-mirror:base/debug/activity_tracker.h: [ master, ] c++ Duplicate result
chromium.googlesource.com/chromium/src:base/debug/activity_tracker.h: [ master, ] c++ Duplicate result
chromium.googlesource.com/chromium/src/codesearch:third_party/mesa/src/src/gallium/auxiliary/util/dbghelp.h: [ master, ] c++
200:     DWORD64 Thread;
216:     DWORD Thread;
1222:       MINIDUMP_THREAD_CALLBACK Thread;
996:   typedef struct _MINIDUMP_THREAD {
1004:   } MINIDUMP_THREAD,*PMINIDUMP_THREAD;
1193:   } THREAD_WRITE_FLAGS;
951:     UnusedStream = 0,ReservedStream0 = 1,ReservedStream1 = 2,ThreadListStream = 3,ModuleListStream = 4,MemoryListStream = 5,
952:     ExceptionStream = 6,SystemInfoStream = 7,ThreadExListStream = 8,Memory64ListStream = 9,CommentStreamA = 10,CommentStreamW = 11,
997:     ULONG32 ThreadId;
1003:     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
1008:     MINIDUMP_THREAD Threads [0];
1012:     ULONG32 ThreadId;
1018:     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
1024:     MINIDUMP_THREAD_EX Threads [0];
1038:     ULONG32 ThreadId;
1041:     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
1074:     DWORD ThreadId;
1080:     DWORD ThreadId;
1163:     ModuleCallback,ThreadCallback,ThreadExCallback,IncludeThreadCallback,IncludeModuleCallback,MemoryCallback
1167:     ULONG ThreadId;
1168:     HANDLE ThreadHandle;
1176:     ULONG ThreadId;
1177:     HANDLE ThreadHandle;
1187:     ULONG ThreadId;
1191:     ThreadWriteThread = 0x0001,ThreadWriteStack = 0x0002,ThreadWriteContext = 0x0004,ThreadWriteBackingStore = 0x0008,
1192:     ThreadWriteInstructionWindow = 0x0010,ThreadWriteThreadData = 0x0020
1223:       MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
1225:       MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
1233:       ULONG ThreadWriteFlags;
1006:   typedef struct _MINIDUMP_THREAD_LIST {
1009<