Found 251657 results in 39797 files, showing top 50 files (show more).
github.com/html5rocks/www.html5rocks.com:static/demos/lemdoodle/examples/lem-planes/combined.js: [ master, ]
5051:   'needle': ['intro-finale/items-needle-thread', 'intro-finale/items-needle'],
5086:   'thread': ['intro-finale/items-thread', 'intro-finale/items-thread'],
5084:   'thread-thimble': ['intro-finale/items-thread-thimble',
5085:                      'intro-finale/items-thread-thimble'],
5102:     'needle', 'halo', 'noodles', 'neutron', 'nose'
5105:     'thread', 'pinstripe', 'neutron', 'noodles', 'clove'
5125:     'thread', 'thimble', 'earmuffs', 'neutron', 'nose'
5131:     'thread', 'thimble', 'noodles', 'neutron', 'nose', 'gnocchi', 'rivet',
13797:     'intro-finale/items-needle-thread',
13798:     'intro-finale/items-needle',
13839:     'intro-finale/items-thread-thimble',
13840:     'intro-finale/items-thread',
15100:   'intro-finale/items-needle-thread': { width: 68, height: 65, x: 834, y: 0 },
15101:   'intro-finale/items-needle': { top: 8, width: 59, height: 51, x: 904, y: 0 },
15142:   'intro-finale/items-thread-thimble': { left: 2, top: 11, bottom: 14, right: 11, width: 52, height: 40, x: 690, y: 96 },
15143:   'intro-finale/items-thread': { left: 4, top: 16, bottom: 15, right: 13, width: 48, height: 34, x: 744, y: 96 },
github.com/html5rocks/www.html5rocks.com:static/demos/lemdoodle/examples/lem-embedded/combined.js: [ master, ]
5024:   'needle': ['intro-finale/items-needle-thread', 'intro-finale/items-needle'],
5059:   'thread': ['intro-finale/items-thread', 'intro-finale/items-thread'],
5057:   'thread-thimble': ['intro-finale/items-thread-thimble',
5058:                      'intro-finale/items-thread-thimble'],
5075:     'needle', 'halo', 'noodles', 'neutron', 'nose'
5078:     'thread', 'pinstripe', 'neutron', 'noodles', 'clove'
5098:     'thread', 'thimble', 'earmuffs', 'neutron', 'nose'
5104:     'thread', 'thimble', 'noodles', 'neutron', 'nose', 'gnocchi', 'rivet',
13827:               // First run: Thread + thimble
13828:               nItems = ['thread', 'thimble'];
13831:               // Second run: Thread/thimble + random item that’s neither
13832:               nItems[0] = 'thread-thimble';
13836:               } while ((nItems[1] == 'thread-thimble') ||
13837:                        (nItems[1] == 'thread') || (nItems[1] == 'thimble'));
13843:             nItems = ['needle', 'noodles'];
13849:               nItems = ['thread', 'thimble'];
13852:               nItems = ['thread-thimble', 'forget-me-not'];
13859:               nItems = ['thread', 'thimble'];
13862:               nItems = ['thread-thimble', 'scissors'];
13868:             nItems = ['thread', 'pinstripe'];
13884:               nItems = ['thread', 'thimble'];
13887:               nItems = ['thread-thimble', 'neutron'];
13894:               nItems = ['thread', 'thimble'];
13897:               nItems = ['thread-thimble', 'basket'];
15362:     'intro-finale/items-needle-thread',
15363:     'intro-finale/items-needle',
15404:     'intro-finale/items-thread-thimble',
15405:     'intro-finale/items-thread',
16665:   'intro-finale/items-needle-thread': { width: 68, height: 65, x: 834, y: 0 },
16666:   'intro-finale/items-needle': { top: 8, width: 59, height: 51, x: 904, y: 0 },
16707:   'intro-finale/items-thread-thimble': { left: 2, top: 11, bottom: 14, right: 11, width: 52, height: 40, x: 690, y: 96 },
16708:   'intro-finale/items-thread': { left: 4, top: 16, bottom: 15, right: 13, width: 48, height: 34, x: 744, y: 96 },
chromium.googlesource.com/arc/arc:third_party/chromium-ppapi/native_client_sdk/src/libraries/third_party/pthreads-win32/implement.h: [ master, ]
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;
944: #define _beginthreadex(security, \
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);
chromium.googlesource.com/chromium/src:native_client_sdk/src/libraries/third_party/pthreads-win32/implement.h: [ master, ] Duplicate result
chromium.googlesource.com/ios-chromium-mirror:native_client_sdk/src/libraries/third_party/pthreads-win32/implement.h: [ master, ] Duplicate result
github.com/google/grumpy:third_party/stdlib/threading.py: [ master, ]
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, ]
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;}
android.googlesource.com/trusty/lk/common:include/kernel/thread.h: [ master, ]
89: typedef struct thread {
46: #define THREAD_STATS 1
47: #define THREAD_STACK_HIGHWATER 1
48: #define THREAD_STACK_BOUNDS_CHECK 1
50: #define THREAD_STACK_PADDING_SIZE 256
54: enum thread_state {
55:     THREAD_SUSPENDED = 0,
56:     THREAD_READY,
57:     THREAD_RUNNING,
58:     THREAD_BLOCKED,
59:     THREAD_SLEEPING,
60:     THREAD_DEATH,
63: typedef int (*thread_start_routine)(void *arg);
66: enum thread_tls_list {
79: #define THREAD_FLAG_DETACHED                  (1U<<0)
80: #define THREAD_FLAG_FREE_STACK                (1U<<1)
81: #define THREAD_FLAG_FREE_STRUCT               (1U<<2)
82: #define THREAD_FLAG_REAL_TIME                 (1U<<3)
83: #define THREAD_FLAG_IDLE                      (1U<<4)
84: #define THREAD_FLAG_DEBUG_STACK_BOUNDS_CHECK  (1U<<5)
85: #define THREAD_FLAG_EXIT_ON_PANIC             (1U<<6)
87: #define THREAD_MAGIC (0x74687264) // 'thrd'
91:     struct list_node thread_list_node;
130: } thread_t;
133: #define thread_curr_cpu(t) ((t)->curr_cpu)
134: #define thread_pinned_cpu(t) ((t)->pinned_cpu)
135: #define thread_set_curr_cpu(t,c) ((t)->curr_cpu = (c))
136: #define thread_set_pinned_cpu(t, c) ((t)->pinned_cpu = (c))
138: #define thread_curr_cpu(t) (0)
139: #define thread_pinned_cpu(t) (-1)
140: #define thread_set_curr_cpu(t,c) do {} while(0)
141: #define thread_set_pinned_cpu(t, c) do {} while(0)
175: static inline void thread_sleep(lk_time_t delay_ms) {
203: #define THREAD_LOCK(state) spin_lock_saved_state_t state; spin_lock_irqsave(&thread_lock, state)
204: #define THREAD_UNLOCK(state) spin_unlock_irqrestore(&thread_lock, state)
206: static inline bool thread_lock_held(void)
212: static inline __ALWAYS_INLINE uintptr_t thread_tls_get(thread_t *t, uint entry)
229: #define thread_tls_set(t,e,v) \
237: static inline void thread_set_flag(thread_t *t, uint flag, bool enable)
248: static inline bool thread_get_flag(thread_t *t, uint flag)
267: static inline void thread_set_flag_exit_on_panic(thread_t *t, bool enable)
272: static inline bool thread_get_flag_exit_on_panic(thread_t *t)
279: struct thread_stats {
297: #define THREAD_STATS_INC(name) do { thread_stats[arch_curr_cpu_num()].name++; } while(0)
301: #define THREAD_STATS_INC(name) do { } while (0)
24: #define __KERNEL_THREAD_H
222: static inline __ALWAYS_INLINE uintptr_t __thread_tls_set(thread_t *t,
23: #ifndef __KERNEL_THREAD_H
31: #include <arch/thread.h>
49: #ifndef THREAD_STACK_PADDING_SIZE
65: /* thread local storage */
96:     enum thread_state state;
112:     struct arch_thread arch;
119:     thread_start_routine entry;
126:     /* thread local storage */
144: /* thread priority */
162: void thread_init_early(void);
163: void thread_init(void);
164: void thread_become_idle(void) __NO_RETURN;
165: void thread_secondary_cpu_init_early(void);
166: void thread_secondary_cpu_entry(void) __NO_RETURN;
167: void thread_set_name(const char *name);
168: void thread_set_priority(int priority);
169: thread_t *thread_create(const char *name, thread_start_routine entry, void *arg, int priority, size_t stack_size);
170: thread_t *thread_create_etc(thread_t *t, const char *name, thread_start_routine entry, void *arg, int priority, void *stack, size_t stack_size);
171: status_t thread_resume(thread_t *);
172: void thread_exit(int retcode) __NO_RETURN;
173: void thread_sleep_ns(lk_time_ns_t delay_ns);
174: void thread_sleep_until_ns(lk_time_ns_t target_time_ns);
176:     thread_sleep_ns(delay_ms * 1000ULL * 1000);
178: status_t thread_detach(thread_t *t);
179: status_t thread_join(thread_t *t, int *retcode, lk_time_t timeout);
180: status_t thread_detach_and_resume(thread_t *t);
181: status_t thread_set_real_time(thread_t *t);
183: void dump_thread(thread_t *t);
184: void arch_dump_thread(thread_t *t);
188: void thread_yield(void); /* give up the cpu voluntarily */
189: void thread_preempt(void); /* get preempted (inserted into head of run queue) */
190: void thread_block(void); /* block on something and reschedule */
191: void thread_unblock(thread_t *t, bool resched); /* go back in the run queue */
194: enum handler_return thread_timer_tick(void);
196: /* the current thread */
197: thread_t *get_current_thread(void);
198: void set_current_thread(thread_t *);
201: extern spin_lock_t thread_lock;
208:     return spin_lock_held(&thread_lock);
211: /* thread local storage */
219:     return thread_tls_get(get_current_thread(), entry);
232:         __thread_tls_set(t, e, v); \
235: #define tls_set(e,v) thread_tls_set(get_current_thread(), e, v)
239:     THREAD_LOCK(state);
245:     THREAD_UNLOCK(state);
251:     THREAD_LOCK(state);
253:     THREAD_UNLOCK(state);
258:  * thread_set_flag_exit_on_panic - Set flag to ignore panic in specific thread
259:  * @t:       Thread to set flag on
260:  * @enable:  If %true, exit thread instead of halting system if panic is called
269:     thread_set_flag(t, THREAD_FLAG_EXIT_ON_PANIC, enable);
274:     return thread_get_flag(t, THREAD_FLAG_EXIT_ON_PANIC);
277: /* thread level statistics */
278: #if THREAD_STATS
295: extern struct thread_stats thread_stats[SMP_MAX_CPUS];
185: void dump_all_threads(void);
264:  * Should only be used for kernel test threads as it is generally not safe to
github.com/apache/activemq-cpp:activemq-cpp/src/main/decaf/util/concurrent/ThreadPoolExecutor.cpp: [ master, ]
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();
github.com/rosjava/rosjava_core:apache_xmlrpc_common/src/main/java/org/apache/xmlrpc/util/ThreadPool.java: [ kinetic, ]
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/googleapis/elixir-google-api:clients/chat/lib/google_api/chat/v1/model/thread.ex: [ master, ]
18: defmodule GoogleApi.Chat.V1.Model.Thread do
20:   A thread in Hangouts Chat.
36: defimpl Poison.Decoder, for: GoogleApi.Chat.V1.Model.Thread do
38:     GoogleApi.Chat.V1.Model.Thread.decode(value, options)
42: defimpl Poison.Encoder, for: GoogleApi.Chat.V1.Model.Thread do
24:   *   `name` (*type:* `String.t`, *default:* `nil`) - Resource name, in the form "spaces/*/threads/*". Example: spaces/AAAAMpdlehY/threads/UMxbHmzDlr4
github.com/apache/logging-log4cxx:src/main/cpp/threadcxx.cpp: [ master, ]
92: 		Thread* thread;
153: Thread::Thread() : thread(NULL), alive(0), interruptedStatus(0),
158: Thread::~Thread()
68: 		Thread* getThread() const
291: bool Thread::isCurrentThread() const
131: ThreadLocal& getThreadLocal()
245: void Thread::currentThreadInterrupt()
19: #include <log4cxx/helpers/thread.h>
21: #include <apr_thread_proc.h>
26: #include <apr_thread_cond.h>
36:  *   Thread::run when they are passed to Thread::launcher.
46: 		 *  before thread is launched.
61: 		LaunchPackage(Thread* t, Runnable r, void* d) : thread(t), runnable(r), data(d)
65: 		 * Gets thread parameter.
66: 		 * @return thread.
70: 			return thread;
83: 		 *  @return thread.
100:  *  Used to maintain Thread.alive.
128:  *   Get a key to the thread local storage used to hold the reference to
129:  *   the corresponding Thread object.
139: void* LOG4CXX_THREAD_FUNC ThreadLaunch::launcher(apr_thread_t* thread, void* data)
145: 		(package->getRunnable())(thread, package->getData());
148: 	apr_thread_exit(thread, 0); // this function never returns !
165: void Thread::run(Runnable start, void* data)
175: 	// now we're ready to create the thread again
177: 	//    if attempting a second run method on the same Thread object
180: 	if (thread != NULL)
193: 	stat = apr_thread_cond_create(&interruptedCondition, p.getAPRPool());
200: 	stat = apr_thread_mutex_create(&interruptedMutex, APR_THREAD_MUTEX_NESTED,
208: 	//   create LaunchPackage on the thread's memory pool
210: 	stat = apr_thread_create(&thread, attrs,
219: 	// if run() has been called in a thread-safe way.
226: void Thread::join()
230: 	if (thread != NULL)
233: 		apr_status_t stat = apr_thread_join(&startStat, thread);
234: 		thread = NULL;
252: 		((Thread*) tls)->interrupt();
258: void Thread::interrupt()
266: 		apr_status_t stat = apr_thread_cond_signal(interruptedCondition);
277: bool Thread::interrupted()
284: 		return apr_atomic_xchg32(&(((Thread*) tls)->interruptedStatus), 0) != 0;
301: bool Thread::isAlive()
306: void Thread::ending()
312: void Thread::sleep(int duration)
323: 		Thread* pThis = (Thread*) getThreadLocal().get();
332: 			apr_status_t stat = apr_thread_cond_timedwait(pThis->interruptedCondition,
24: #include <log4cxx/helpers/threadlocal.h>
31: #if APR_HAS_THREADS
133: 	static ThreadLocal tls;
142: 	ThreadLocal& tls = getThreadLocal();
143: 	tls.set(package->getThread());
146: 		package->getThread()->ending();
167: #if APR_HAS_THREADS
185: 	apr_threadattr_t* attrs;
186: 	apr_status_t stat = apr_threadattr_create(&attrs, p.getAPRPool());
190: 		throw ThreadException(stat);
197: 		throw ThreadException(stat);
205: 		throw ThreadException(stat);
211: 			ThreadLaunch::launcher, package, p.getAPRPool());
215: 		throw ThreadException(stat);
222: 	throw ThreadException(LOG4CXX_STR("APR_HAS_THREADS is not true"));
228: #if APR_HAS_THREADS
238: 			throw ThreadException(stat);
247: #if APR_HAS_THREADS
261: #if APR_HAS_THREADS
270: 			throw ThreadException(stat);
279: #if APR_HAS_THREADS
293: #if APR_HAS_THREADS
314: #if APR_HAS_THREADS
337: 				throw ThreadException(stat);
248: 	void* tls = getThreadLocal().get();
280: 	void* tls = getThreadLocal().get();
294: 	const void* tls = getThreadLocal().get();
github.com/GNOME/libdazzle:src/search/dzl-fuzzy-index-cursor.c: [ mainline, ]
65:   const gchar                     *needle;
408:   lookup.needle = query;
550:   g_task_run_in_thread (task, dzl_fuzzy_index_cursor_worker);
github.com/googlegsa/sharepoint.v3:projects/ApacheHttpClient/src/java/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.java: [ master, ]
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/texmacs/guile:libguile/threads.c: [ texmacs, ]
756:   SCM thread;
842:   SCM thread;
131: thread_mark (SCM obj)
143: thread_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
178: thread_free (SCM obj)
403: static scm_i_pthread_mutex_t thread_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
405: static int thread_count;
784: launch_thread (void *d)
873: spawn_thread (void *d)
882: scm_spawn_thread (scm_t_catch_body body, void *body_data,
1712: scm_t_bits scm_tc16_thread;
1610: static int threads_initialized_p = 0;
355: scm_i_pthread_key_t scm_i_thread_key;
508: do_thread_exit (void *v)
525: on_thread_exit (void *v)
552: static scm_i_pthread_once_t init_thread_key_once = SCM_I_PTHREAD_ONCE_INIT;
555: init_thread_key (void)
573: scm_i_init_thread_for_guile (SCM_STACKITEM *base, SCM parent)
638: #define HAVE_GET_THREAD_STACK_BASE
641: get_thread_stack_base ()
674: #define HAVE_GET_THREAD_STACK_BASE
676: get_thread_stack_base ()
686: #define HAVE_GET_THREAD_STACK_BASE
688: get_thread_stack_base ()
697: #define HAVE_GET_THREAD_STACK_BASE
700: get_thread_stack_base ()
1609: int scm_i_thread_go_to_sleep;
1613: scm_i_thread_put_to_sleep ()
1632: scm_i_thread_invalidate_freelists ()
1643: scm_i_thread_wake_up ()
1658: scm_i_thread_sleep_for_gc ()
1751: scm_init_thread_procs ()
404: static scm_i_thread *all_threads = NULL;
1396: scm_threads_mark_stacks (void)
1479: scm_pthread_mutex_lock (scm_i_pthread_mutex_t *mutex)
1494: scm_dynwind_pthread_mutex_lock (scm_i_pthread_mutex_t *mutex)
1501: scm_pthread_cond_wait (scm_i_pthread_cond_t *cond, scm_i_pthread_mutex_t *mutex)
1510: scm_pthread_cond_timedwait (scm_i_pthread_cond_t *cond,
1690: pthread_mutexattr_t scm_i_pthread_mutexattr_recursive[1];
1694: scm_threads_prehistory (SCM_STACKITEM *base)
1717: scm_init_threads ()
1744: scm_init_threads_default_dynamic_state ()
128: /*** Thread smob routines */
133:   scm_i_thread *t = SCM_I_THREAD_DATA (obj);
156:   scm_i_thread *t = SCM_I_THREAD_DATA (exp);
169:   scm_puts ("#<thread ", port);
180:   scm_i_thread *t = SCM_I_THREAD_DATA (obj);
182:   scm_gc_free (t, sizeof (*t), "thread");
192: /* Put the current thread on QUEUE and go to sleep, waiting for it to
194:    interrupted.  Upon return of this function, the current thread is
218:   scm_i_thread *t = SCM_I_CURRENT_THREAD;
246: /* Wake up the first thread on QUEUE, if any.  The caller must hold
247:    the mutex that protects QUEUE.  The awoken thread is returned, or
253:   SCM thread = dequeue (queue);
254:   if (scm_is_true (thread))
255:     scm_i_pthread_cond_signal (&SCM_I_THREAD_DATA(thread)->sleep_cond);
256:   return thread;
304:    run, triggered by another thread.
306:    The thread calling foo is out of Guile mode at the time, so the
358: resume (scm_i_thread *t)
374:   scm_i_thread *t = (scm_i_thread *)ticket;
382: static scm_i_thread *
385:   scm_i_thread *t = SCM_I_CURRENT_THREAD;
398:   scm_i_thread *t = suspend ();
409: /* Perform first stage of thread initialisation, in non-guile mode.
414:   scm_i_thread *t = malloc (sizeof (scm_i_thread));
429:   /* Calculate and store off the base of this thread's register
432:      main thread.  For other threads, therefore, find out the current
467:   scm_i_pthread_setspecific (scm_i_thread_key, t);
469:   /* As soon as this thread adds itself to the global thread list, the
472:      before the thread can lock its heap_mutex for the first time. */
474:   scm_i_pthread_mutex_lock (&thread_admin_mutex);
475:   t->next_thread = all_threads;
477:   thread_count++;
478:   scm_i_pthread_mutex_unlock (&thread_admin_mutex);
484: /* Perform second stage of thread initialisation, in guile mode.
489:   scm_i_thread *t = SCM_I_CURRENT_THREAD;
491:   SCM_NEWSMOB (t->handle, scm_tc16_thread, t);
492:   scm_gc_register_collectable_memory (t, sizeof (scm_i_thread), "thread");
505: /* Perform thread tear-down, in guile mode.
510:   scm_i_thread *t = (scm_i_thread *)v;
512:   scm_i_scm_pthread_mutex_lock (&thread_admin_mutex);
520:   scm_i_pthread_mutex_unlock (&thread_admin_mutex);
528:   scm_i_thread *t = (scm_i_thread *)v, **tp;
530:   scm_i_pthread_setspecific (scm_i_thread_key, v);
534:   scm_with_guile (do_thread_exit, v);
539:   scm_i_pthread_mutex_lock (&thread_admin_mutex);
540:   for (tp = &all_threads; *tp; tp = &(*tp)->next_thread)
543: 	*tp = t->next_thread;
546:   thread_count--;
547:   scm_i_pthread_mutex_unlock (&thread_admin_mutex);
549:   scm_i_pthread_setspecific (scm_i_thread_key, NULL);
557:   scm_i_pthread_key_create (&scm_i_thread_key, on_thread_exit);
560: /* Perform any initializations necessary to bring the current thread
568:    Return zero when the thread was in guile mode already; otherwise
575:   scm_i_thread *t;
577:   scm_i_pthread_once (&init_thread_key_once, init_thread_key);
579:   if ((t = SCM_I_CURRENT_THREAD) == NULL)
581:       /* This thread has not been guilified yet.
587: 	  /* First thread ever to enter Guile.  Run the full
595: 	  /* Guile is already initialized, but this thread enters it for
596: 	     the first time.  Only initialize this thread.
606:       /* This thread is already guilified but not in guile mode, just
611:          stack than when it was when this thread was first guilified.  Thus,
626:       /* Thread is already in guile mode.  Nothing to do.
652:      for the main thread, but we can use scm_get_stack_base in that
683:    in any thread.  We don't like hard-coding the name of a system, but there
693: #endif /* pthread methods of get_thread_stack_base */
707: #ifdef HAVE_GET_THREAD_STACK_BASE
712:   scm_i_init_thread_for_guile (get_thread_stack_base (),
732:   really_entered = scm_i_init_thread_for_guile (&base_item, parent);
750: /*** Thread creation */
766:   scm_i_thread *t;
768:   t = SCM_I_CURRENT_THREAD;
771:   data->thread = scm_current_thread ();
792: SCM_DEFINE (scm_call_with_new_thread, "call-with-new-thread", 1, 1, 0,
794: 	    "Call @code{thunk} in a new thread and with a new dynamic state,\n"
795: 	    "returning a new thread object representing the thread.  The procedure\n"
803: 	    "the @emph{exit value} of the thread and the thread is terminated.")
804: #define FUNC_NAME s_scm_call_with_new_thread
817:   data.thread = SCM_BOOL_F;
822:   err = scm_i_pthread_create (&id, NULL, launch_thread, &data);
832:   return data.thread;
855:   scm_i_thread *t = SCM_I_CURRENT_THREAD;
858:   data->thread = scm_current_thread ();
894:   data.thread = SCM_BOOL_F;
899:   err = scm_i_pthread_create (&id, NULL, spawn_thread, &data);
909:   return data.thread;
914: "Move the calling thread to the end of the scheduling queue.")
921: SCM_DEFINE (scm_join_thread, "join-thread", 1, 0, 0,
922: 	    (SCM thread),
923: "Suspend execution of the calling thread until the target @var{thread} "
924: "terminates, unless the target @var{thread} has already terminated. ")
925: #define FUNC_NAME s_scm_join_thread
927:   scm_i_thread *t;
930:   SCM_VALIDATE_THREAD (1, thread);
931:   if (scm_is_eq (scm_current_thread (), thread))
932:     SCM_MISC_ERROR ("can not join the current thread", SCM_EOL);
934:   scm_i_scm_pthread_mutex_lock (&thread_admin_mutex);
936:   t = SCM_I_THREAD_DATA (thread);
939:       block_self (t->join_queue, thread, &thread_admin_mutex, NULL);
942:       scm_i_pthread_mutex_unlock (&thread_admin_mutex);
944:       scm_i_scm_pthread_mutex_lock (&thread_admin_mutex);
948:   scm_i_pthread_mutex_unlock (&thread_admin_mutex);
1037:   SCM thread = scm_current_thread ();
1042:     m->owner = thread;
1043:   else if (scm_is_eq (m->owner, thread))
1048: 	msg = "mutex already locked by current thread";
1054: 	  if (scm_is_eq (m->owner, thread))
1068: "Lock @var{mutex}. If the mutex is already locked, the calling thread "
1070: "the calling thread owns the lock on @var{mutex}.  Locking a mutex that "
1071: "a thread already owns will succeed right away and will not block the "
1072: "thread.  That is, Guile's mutexes are @emph{recursive}. ")
1098:   SCM thread = scm_current_thread ();
1103:     m->owner = thread;
1104:   else if (scm_is_eq (m->owner, thread))
1109: 	msg = "mutex already locked by current thread";
1141:   if (!scm_is_eq (m->owner, scm_current_thread ()))
1146: 	msg = "mutex not locked by current thread";
1159: "Unlocks @var{mutex} if the calling thread owns the lock on "
1161: "thread results in undefined behaviour. Once a mutex has been unlocked, "
1162: "one thread blocked on @var{mutex} is awakened and grabs the mutex "
1163: "lock.  Every call to @code{lock-mutex} by this thread must be matched "
1182: 	    "Return the thread owning @var{mx}, or @code{#f}.")
1260:   scm_i_thread *t = SCM_I_CURRENT_THREAD;
1346: 	    "Wake up one thread that is waiting for @var{cv}")
1388:     bot = (SCM_STACKITEM *) SCM_I_CURRENT_THREAD->register_backing_store_base;  \
1398:   scm_i_thread *t;
1399:   for (t = all_threads; t; t = t->next_thread)
1401:       /* Check that thread has indeed been suspended.
1431:   scm_i_thread *t = SCM_I_CURRENT_THREAD;
1544: SCM_DEFINE (scm_current_thread, "current-thread", 0, 0, 0,
1546: 	    "Return the thread that called this function.")
1547: #define FUNC_NAME s_scm_current_thread
1549:   return SCM_I_CURRENT_THREAD->handle;
1567:   /* We can not allocate while holding the thread_admin_mutex because
1570:   int n = thread_count;
1571:   scm_i_thread *t;
1574:   scm_i_pthread_mutex_lock (&thread_admin_mutex);
1576:   for (t = all_threads; t && n > 0; t = t->next_thread)
1583:   scm_i_pthread_mutex_unlock (&thread_admin_mutex);
1588: SCM_DEFINE (scm_thread_exited_p, "thread-exited?", 1, 0, 0,
1589: 	    (SCM thread),
1590: 	    "Return @code{#t} iff @var{thread} has exited.\n")
1591: #define FUNC_NAME s_scm_thread_exited_p
1593:   return scm_from_bool (scm_c_thread_exited_p (thread));
1598: scm_c_thread_exited_p (SCM thread)
1599: #define FUNC_NAME  s_scm_thread_exited_p
1601:   scm_i_thread *t;
1602:   SCM_VALIDATE_THREAD (1, thread);
1603:   t = SCM_I_THREAD_DATA (thread);
1617:       scm_i_thread *t;
1620:       scm_i_pthread_mutex_lock (&thread_admin_mutex);
1624:       scm_i_thread_go_to_sleep = 1;
1625:       for (t = all_threads; t; t = t->next_thread)
1627:       scm_i_thread_go_to_sleep = 0;
1634:   /* thread_admin_mutex is already locked. */
1636:   scm_i_thread *t;
1637:   for (t = all_threads; t; t = t->next_thread)
1638:     if (t != SCM_I_CURRENT_THREAD)
1647:       scm_i_thread *t;
1650:       for (t = all_threads; t; t = t->next_thread)
1652:       scm_i_pthread_mutex_unlock (&thread_admin_mutex);
1653:       scm_enter_guile ((scm_t_guile_ticket) SCM_I_CURRENT_THREAD);
1660:   scm_i_thread *t = suspend ();
1719:   scm_tc16_thread = scm_make_smob_type ("thread", sizeof (scm_i_thread));
1720:   scm_set_smob_mark (scm_tc16_thread, thread_mark);
1721:   scm_set_smob_print (scm_tc16_thread, thread_print);
1722:   scm_set_smob_free (scm_tc16_thread, thread_free);
45: #include "libguile/threads.h"
145:   /* On a Gnu system pthread_t is an unsigned long, but on mingw it's a
146:      struct.  A cast like "(unsigned long) t->pthread" is a syntax error in
148:      size of pthread_t.  */
150:     scm_i_pthread_t p;
157:   scm_i_pthread_t p = t->pthread;
199:    unlocked while sleeping, just as with scm_i_pthread_cond_wait.
215: block_self (SCM queue, SCM sleep_object, scm_i_pthread_mutex_t *mutex,
229: 	err = scm_i_scm_pthread_cond_wait (&t->sleep_cond, mutex);
231: 	err = scm_i_scm_pthread_cond_timedwait (&t->sleep_cond, mutex, waittime);
346:    kind of like pthread_cleanup_push/pop calls that have to be paired up
347:    in a function.  (In fact, the pthread ones have to be paired up
352:    pthread_cancel.)
377:       scm_i_pthread_mutex_lock (&t->heap_mutex);
399:   scm_i_pthread_mutex_unlock (&t->heap_mutex);
416:   t->pthread = scm_i_pthread_self ();
446:   scm_i_pthread_cond_init (&t->sleep_cond, NULL);
457:   scm_i_pthread_mutex_init (&t->heap_mutex, NULL);
476:   all_threads = t;
532:   /* Unblocking the joining threads needs to happen in guile mode
536:   /* Removing ourself from the list of all threads needs to happen in
584:       scm_i_pthread_mutex_lock (&scm_i_init_mutex);
591: 	  scm_i_pthread_mutex_unlock (&scm_i_init_mutex);
598: 	  scm_i_pthread_mutex_unlock (&scm_i_init_mutex);
632: #if SCM_USE_PTHREAD_THREADS
634: #if HAVE_PTHREAD_ATTR_GETSTACK && HAVE_PTHREAD_GETATTR_NP
636:    It's not for MacOS X or Solaris 10, since pthread_getattr_np is not
643:   pthread_attr_t attr;
647:   pthread_getattr_np (pthread_self (), &attr);
648:   pthread_attr_getstack (&attr, &start, &size);
651:   /* XXX - pthread_getattr_np from LinuxThreads does not seem to work
656: #ifndef PTHREAD_ATTR_GETSTACK_WORKS
670: #elif HAVE_PTHREAD_GET_STACKADDR_NP
672:    It'd be nice if there was some documentation on pthread_get_stackaddr_np,
678:   return pthread_get_stackaddr_np (pthread_self ());
695: #else /* !SCM_USE_PTHREAD_THREADS */
705: #endif /* !SCM_USE_PTHREAD_THREADS */
757:   scm_i_pthread_mutex_t mutex;
758:   scm_i_pthread_cond_t cond;
770:   scm_i_scm_pthread_mutex_lock (&data->mutex);
772:   scm_i_pthread_cond_signal (&data->cond);
773:   scm_i_pthread_mutex_unlock (&data->mutex);
787:   scm_i_pthread_detach (scm_i_pthread_self ());
807:   scm_i_pthread_t id;
818:   scm_i_pthread_mutex_init (&data.mutex, NULL);
819:   scm_i_pthread_cond_init (&data.cond, NULL);
821:   scm_i_scm_pthread_mutex_lock (&data.mutex);
825:       scm_i_pthread_mutex_unlock (&data.mutex);
829:   scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
830:   scm_i_pthread_mutex_unlock (&data.mutex);
843:   scm_i_pthread_mutex_t mutex;
844:   scm_i_pthread_cond_t cond;
857:   scm_i_scm_pthread_mutex_lock (&data->mutex);
859:   scm_i_pthread_cond_signal (&data->cond);
860:   scm_i_pthread_mutex_unlock (&data->mutex);
876:   scm_i_pthread_detach (scm_i_pthread_self ());
886:   scm_i_pthread_t id;
895:   scm_i_pthread_mutex_init (&data.mutex, NULL);
896:   scm_i_pthread_cond_init (&data.cond, NULL);
898:   scm_i_scm_pthread_mutex_lock (&data.mutex);
902:       scm_i_pthread_mutex_unlock (&data.mutex);
906:   scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
907:   scm_i_pthread_mutex_unlock (&data.mutex);
962:   scm_i_pthread_mutex_t lock;
966:   SCM waiting;    /* the threads waiting for this mutex. */
984:   scm_i_pthread_mutex_destroy (&m->lock);
1006:   scm_i_pthread_mutex_init (&m->lock, NULL);
1040:   scm_i_scm_pthread_mutex_lock (&m->lock);
1057: 	  scm_i_pthread_mutex_unlock (&m->lock);
1059: 	  scm_i_scm_pthread_mutex_lock (&m->lock);
1062:   scm_i_pthread_mutex_unlock (&m->lock);
1101:   scm_i_pthread_mutex_lock (&m->lock);
1113:   scm_i_pthread_mutex_unlock (&m->lock);
1140:   scm_i_scm_pthread_mutex_lock (&m->lock);
1152:   scm_i_pthread_mutex_unlock (&m->lock);
1206:   scm_i_pthread_mutex_t lock;
1207:   SCM waiting;               /* the threads waiting for this condition. */
1224:   scm_i_pthread_mutex_destroy (&c->lock);
1248:   scm_i_pthread_mutex_init (&c->lock, 0);
1268:       scm_i_scm_pthread_mutex_lock (&c->lock);
1274: 	  scm_i_pthread_mutex_unlock (&c->lock);
1278: 	scm_i_pthread_mutex_unlock (&c->lock);
1339:   scm_i_scm_pthread_mutex_lock (&c->lock);
1341:   scm_i_pthread_mutex_unlock (&c->lock);
1358:   scm_i_scm_pthread_mutex_lock (&c->lock);
1361:   scm_i_pthread_mutex_unlock (&c->lock);
1366: 	    "Wake up all threads that are waiting for @var{cv}. ")
1378:    threads as well?
1476: #if SCM_USE_PTHREAD_THREADS
1482:   int res = scm_i_pthread_mutex_lock (mutex);
1490:   scm_i_pthread_mutex_unlock ((scm_i_pthread_mutex_t *)data);
1496:   scm_i_scm_pthread_mutex_lock (mutex);
1504:   int res = scm_i_pthread_cond_wait (cond, mutex);
1511: 			    scm_i_pthread_mutex_t *mutex,
1515:   int res = scm_i_pthread_cond_timedwait (cond, mutex, wt);
1562: SCM_DEFINE (scm_all_threads, "all-threads", 0, 0, 0,
1564: 	    "Return a list of all threads.")
1565: #define FUNC_NAME s_scm_all_threads
1608: static scm_i_pthread_cond_t wake_up_cond;
1615:   if (threads_initialized_p)
1622:       /* Signal all threads to go to sleep 
1626: 	scm_i_pthread_mutex_lock (&t->heap_mutex);
1645:   if (threads_initialized_p)
1649:       scm_i_pthread_cond_broadcast (&wake_up_cond);
1651: 	scm_i_pthread_mutex_unlock (&t->heap_mutex);
1661:   scm_i_pthread_cond_wait (&wake_up_cond, &t->heap_mutex);
1667: scm_i_pthread_mutex_t scm_i_critical_section_mutex;
1682: scm_i_pthread_key_t scm_i_freelist, scm_i_freelist2;
1684: scm_i_pthread_key_t *scm_i_freelist_ptr = &scm_i_freelist;
1685: scm_i_pthread_key_t *scm_i_freelist2_ptr = &scm_i_freelist2;
1687: scm_i_pthread_mutex_t scm_i_misc_mutex;
1689: #if SCM_USE_PTHREAD_THREADS
1696: #if SCM_USE_PTHREAD_THREADS
1697:   pthread_mutexattr_init (scm_i_pthread_mutexattr_recursive);
1698:   pthread_mutexattr_settype (scm_i_pthread_mutexattr_recursive,
1699: 			     PTHREAD_MUTEX_RECURSIVE);
1702:   scm_i_pthread_mutex_init (&scm_i_critical_section_mutex,
1703: 			    scm_i_pthread_mutexattr_recursive);
1704:   scm_i_pthread_mutex_init (&scm_i_misc_mutex, NULL);
1705:   scm_i_pthread_cond_init (&wake_up_cond, NULL);
1706:   scm_i_pthread_key_create (&scm_i_freelist, NULL);
1707:   scm_i_pthread_key_create (&scm_i_freelist2, NULL);
1737:   threads_initialized_p = 1;
1753: #include "libguile/threads.x"
github.com/google/starlark-go:starlark/eval.go: [ master, ]
30: type Thread struct {
27: // A Thread contains the state of a Starlark thread,
28: // such as its call stack and thread-local storage.
29: // The Thread is threaded throughout the evaluator.
31: 	// Name is an optional name that describes the thread, for debugging.
40: 	Print func(thread *Thread, msg string)
48: 	Load func(thread *Thread, module string) (StringDict, error)
50: 	// steps counts abstract computation steps executed by this thread.
56: 	// locals holds arbitrary "thread-local" Go values belonging to the client.
65: // by this thread. It is incremented by the interpreter. It may be used
70: func (thread *Thread) ExecutionSteps() uint64 {
71: 	return thread.steps
75: // computation steps that may be executed by this thread. If the
76: // thread's step counter exceeds this limit, the interpreter calls
77: // thread.Cancel("too many steps").
78: func (thread *Thread) SetMaxExecutionSteps(max uint64) {
79: 	thread.maxSteps = max
82: // Cancel causes execution of Starlark code in the specified thread to
85: // if the thread is currently in a call to a built-in function.
89: // Unlike most methods of Thread, it is safe to call Cancel from any
90: // goroutine, even if the thread is actively executing.
91: func (thread *Thread) Cancel(reason string) {
93: 	atomic.CompareAndSwapPointer((*unsafe.Pointer)(unsafe.Pointer(&thread.cancelReason)), nil, unsafe.Pointer(&reason))
96: // SetLocal sets the thread-local value associated with the specified key.
98: func (thread *Thread) SetLocal(key string, value interface{}) {
99: 	if thread.locals == nil {
100: 		thread.locals = make(map[string]interface{})
102: 	thread.locals[key] = value
105: // Local returns the thread-local value associated with the specified key.
106: func (thread *Thread) Local(key string) interface{} {
107: 	return thread.locals[key]
115: func (thread *Thread) CallFrame(depth int) CallFrame {
116: 	return thread.frameAt(depth).asCallFrame()
119: func (thread *Thread) frameAt(depth int) *frame {
120: 	return thread.stack[len(thread.stack)-1-depth]
123: // CallStack returns a new slice containing the thread's stack of call frames.
124: func (thread *Thread) CallStack() CallStack {
125: 	frames := make([]CallFrame, len(thread.stack))
126: 	for i, fr := range thread.stack {
133: func (thread *Thread) CallStackDepth() int { return len(thread.stack) }
228: // a copy of the thread's stack at the moment of the error.
249: func (thread *Thread) evalError(err error) *EvalError {
252: 		CallStack: thread.CallStack(),
308: // Thread is the state associated with the Starlark thread.
322: func ExecFile(thread *Thread, filename string, src interface{}, predeclared StringDict) (StringDict, error) {
329: 	g, err := mod.Init(thread, predeclared)
398: func (prog *Program) Init(thread *Thread, predeclared StringDict) (StringDict, error) {
401: 	_, err := Call(thread, toplevel, nil, nil)
408: // ExecREPLChunk compiles and executes file f in the specified thread
416: func ExecREPLChunk(f *syntax.File, thread *Thread, globals StringDict) error {
447: 	_, err := Call(thread, toplevel, nil, nil)
500: func Eval(thread *Thread, filename string, src interface{}, env StringDict) (Value, error) {
509: 	return Call(thread, f, nil, nil)
524: func EvalExpr(thread *Thread, expr syntax.Expr, env StringDict) (Value, error) {
529: 	return Call(thread, fn, nil, nil)
935: 			needle, ok := x.(String)
939: 			return Bool(strings.Contains(string(y), string(needle))), nil
1103: func Call(thread *Thread, fn Value, args Tuple, kwargs []Tuple) (Value, error) {
1111: 	// Optimization: use slack portion of thread.stack
1113: 	if n := len(thread.stack); n < cap(thread.stack) {
1114: 		fr = thread.stack[n : n+1][0]
1120: 	if thread.stack == nil {
1121: 		// one-time initialization of thread
1122: 		if thread.maxSteps == 0 {
1123: 			thread.maxSteps-- // (MaxUint64)
1127: 	thread.stack = append(thread.stack, fr) // push
1131: 	thread.beginProfSpan()
1132: 	result, err := c.CallInternal(thread, args, kwargs)
1133: 	thread.endProfSpan()
1143: 			err = thread.evalError(err)
1148: 	thread.stack = thread.stack[:len(thread.stack)-1] // pop
github.com/GNOME/gnome-notes:src/bjb-controller.c: [ mainline, ]
47:   gchar          *needle;
68:   PROP_NEEDLE,
526: bjb_controller_apply_needle (BjbController *self)
777: bjb_controller_set_needle (BjbController *self, const gchar *needle )
787: bjb_controller_get_needle (BjbController *self)
556: on_needle_changed (BjbController *self)
45:   /* needle, notebook and group define what the controller shows */
122:   g_free (self->needle);
147:   case PROP_NEEDLE:
148:     g_value_set_string (value, self->needle);
175:   case PROP_NEEDLE:
176:     self->needle = g_strdup (g_value_get_string (value));
193:   const gchar *needle = NULL;
196:       needle = biji_item_get_uuid (item);
209:     if (needle && g_strcmp0 (item_path, needle) == 0)
213:     else if (!needle && BIJI_IS_NOTE_OBJ (
308:   if (!self->needle || g_strcmp0 (self->needle, "") == 0)
323:     if (g_strrstr (title, self->needle) != NULL)
330:       if (g_strrstr (content, self->needle) != NULL)
529:   gchar *needle;
531:   needle = self->needle;
536:   if (needle == NULL || g_strcmp0 (needle,"") == 0)
552:   biji_get_items_matching_async (self->manager, self->group, needle, update_controller_callback, self);
558:   bjb_controller_apply_needle (self);
598:       bjb_controller_apply_needle (self);
648:     /* Apply the needle to display the relevant items.
650:      * Use another thread for this, because controller is now up to date,
656:       bjb_controller_apply_needle (self);
738:   properties[PROP_NEEDLE] = g_param_spec_string ("needle",
739:                                                  "Needle",
761:                     gchar         *needle)
766:               "needle", needle,
779:   if (self->needle)
780:     g_free (self->needle);
782:   self->needle = g_strdup (needle);
783:   on_needle_changed (self);
789:   if (!self->needle)
792:   return self->needle;
827:     bjb_controller_apply_needle (self);
834:   g_clear_pointer (&self->needle, g_free);
836:   self->needle = g_strdup ("");
871:       bjb_controller_apply_needle (self);
877:     bjb_controller_apply_needle (self);
894:     on_needle_changed (self);
github.com/apache/attic-polygene-sandbox:libraries/thread/src/main/java/org/qi4j/library/thread/PooledThreadServiceMixin.java: [ master, ]
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/GNOME/gupnp-igd:libgupnp-igd/gupnp-simple-igd-thread.c: [ mainline, ]
68:   GThread *thread;
55: struct thread_data
75:   struct thread_data *thread_data;
257: thread_data_dec (struct thread_data *data)
283: thread_func (gpointer dat)
81: #define GUPNP_SIMPLE_IGD_THREAD_GET_PRIVATE(o)                        \
85: #define GUPNP_SIMPLE_IGD_THREAD_LOCK(o) \
87: #define GUPNP_SIMPLE_IGD_THREAD_UNLOCK(o) \
130: gupnp_simple_igd_thread_class_init (GUPnPSimpleIgdThreadClass *klass)
148: gupnp_simple_igd_thread_init (GUPnPSimpleIgdThread *self)
188: gupnp_simple_igd_thread_dispose (GObject *object)
268: gupnp_simple_igd_thread_finalize (GObject *object)
311: gupnp_simple_igd_thread_constructor (GType type,
324: gupnp_simple_igd_thread_constructed (GObject *object)
454: gupnp_simple_igd_thread_add_port (GUPnPSimpleIgd *self,
488: gupnp_simple_igd_thread_remove_port (GUPnPSimpleIgd *self,
514: gupnp_simple_igd_thread_remove_port_local (GUPnPSimpleIgd *self,
550: gupnp_simple_igd_thread_new ()
47: struct _GUPnPSimpleIgdThreadClass
66: struct _GUPnPSimpleIgdThreadPrivate
25:  * SECTION:gupnp-simple-igd-thread
28:  * This wraps a #GUPnPSimpleIgd into a thread so that it can be used without
37: #include "gupnp-simple-igd-thread.h"
71:   /* Protected by mutex  inside thread_data*/
82:   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GUPNP_TYPE_SIMPLE_IGD_THREAD,    \
86:   g_mutex_lock (&(o)->priv->thread_data->mutex)
88:   g_mutex_unlock (&(o)->priv->thread_data->mutex)
91: G_DEFINE_TYPE_WITH_CODE (GUPnPSimpleIgdThread, gupnp_simple_igd_thread,
94: static void gupnp_simple_igd_thread_constructed (GObject *object);
95: static GObject *gupnp_simple_igd_thread_constructor (GType type,
98: static void gupnp_simple_igd_thread_dispose (GObject *object);
99: static void gupnp_simple_igd_thread_finalize (GObject *object);
101: static void gupnp_simple_igd_thread_add_port (GUPnPSimpleIgd *self,
108: static void gupnp_simple_igd_thread_remove_port (GUPnPSimpleIgd *self,
111: static void gupnp_simple_igd_thread_remove_port_local (GUPnPSimpleIgd *self,
135:   gobject_class->constructed = gupnp_simple_igd_thread_constructed;
136:   gobject_class->constructor = gupnp_simple_igd_thread_constructor;
137:   gobject_class->dispose = gupnp_simple_igd_thread_dispose;
138:   gobject_class->finalize = gupnp_simple_igd_thread_finalize;
140:   simple_igd_class->add_port = gupnp_simple_igd_thread_add_port;
141:   simple_igd_class->remove_port = gupnp_simple_igd_thread_remove_port;
143:       gupnp_simple_igd_thread_remove_port_local;
150:   self->priv = gupnp_simple_igd_thread_get_instance_private (self);
166:   GUPNP_SIMPLE_IGD_THREAD_LOCK (self);
168:   self->priv->thread_data->all_mappings_deleted = TRUE;
169:   GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
179:   GUPNP_SIMPLE_IGD_THREAD_LOCK (self);
180:   if (self->priv->thread_data->loop)
181:     g_main_loop_quit (self->priv->thread_data->loop);
182:   GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
190:   GUPnPSimpleIgdThread *self = GUPNP_SIMPLE_IGD_THREAD_CAST (object);
192:   GUPNP_SIMPLE_IGD_THREAD_LOCK (self);
202:   if (g_thread_self () == self->priv->thread)
204:     GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
209:     GUPNP_SIMPLE_IGD_THREAD_LOCK (self);
210:     if (self->priv->thread_data->loop)
211:       g_main_loop_quit (self->priv->thread_data->loop);
212:     GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
214:   else if (self->priv->thread)
226:     while (!self->priv->thread_data->all_mappings_deleted)
228:           &self->priv->thread_data->mutex);
232:       GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
236:     if (self->priv->thread_data->loop)
244:       if (self->priv->thread_data->loop)
245:         g_main_loop_quit (self->priv->thread_data->loop);
247:     GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
249:     g_thread_join (self->priv->thread);
250:     self->priv->thread = NULL;
253:   G_OBJECT_CLASS (gupnp_simple_igd_thread_parent_class)->dispose (object);
263:     g_slice_free (struct thread_data, data);
270:   GUPnPSimpleIgdThread *self = GUPNP_SIMPLE_IGD_THREAD_CAST (object);
277:   thread_data_dec (self->priv->thread_data);
279:   G_OBJECT_CLASS (gupnp_simple_igd_thread_parent_class)->finalize (object);
285:   struct thread_data *data = dat;
288:   g_main_context_push_thread_default (data->context);
301:   g_main_context_pop_thread_default (data->context);
305:   thread_data_dec (data);
317:   return G_OBJECT_CLASS (gupnp_simple_igd_thread_parent_class)->constructor (
326:   GUPnPSimpleIgdThread *self = GUPNP_SIMPLE_IGD_THREAD_CAST (object);
327:   struct thread_data *data = g_slice_new0 (struct thread_data);
329:   g_main_context_push_thread_default (self->priv->context);
330:   if (G_OBJECT_CLASS (gupnp_simple_igd_thread_parent_class)->constructed)
331:     G_OBJECT_CLASS (gupnp_simple_igd_thread_parent_class)->constructed (object);
332:   g_main_context_pop_thread_default (self->priv->context);
336:   self->priv->thread_data = data;
342:   self->priv->thread = g_thread_new ("gupnp-igd-thread", thread_func, data);
343:   g_return_if_fail (self->priv->thread);
351:       GUPNP_SIMPLE_IGD_CLASS (gupnp_simple_igd_thread_parent_class);
379:       GUPNP_SIMPLE_IGD_CLASS (gupnp_simple_igd_thread_parent_class);
404:       GUPNP_SIMPLE_IGD_CLASS (gupnp_simple_igd_thread_parent_class);
438:       GUPNP_SIMPLE_IGD_THREAD_LOCK (self);
440:       GUPNP_SIMPLE_IGD_THREAD_UNLOCK (self);
462:   GUPnPSimpleIgdThread *realself = GUPNP_SIMPLE_IGD_THREAD (self);
474:   GUPNP_SIMPLE_IGD_THREAD_LOCK (realself);
476:   GUPNP_SIMPLE_IGD_THREAD_UNLOCK (realself);
492:   GUPnPSimpleIgdThread *realself = GUPNP_SIMPLE_IGD_THREAD (self);
500:   GUPNP_SIMPLE_IGD_THREAD_LOCK (realself);
502:   GUPNP_SIMPLE_IGD_THREAD_UNLOCK (realself);
519:   GUPnPSimpleIgdThread *realself = GUPNP_SIMPLE_IGD_THREAD (self);
528:   GUPNP_SIMPLE_IGD_THREAD_LOCK (realself);
530:   GUPNP_SIMPLE_IGD_THREAD_UNLOCK (realself);
542:  * gupnp_simple_igd_thread_new:
552:   return g_object_new (GUPNP_TYPE_SIMPLE_IGD_THREAD, NULL);
26:  * @short_description: Threaded wrapper for GUPnPSimpleIgd
92:     GUPNP_TYPE_SIMPLE_IGD, G_ADD_PRIVATE (GUPnPSimpleIgdThread));
119:   GUPnPSimpleIgdThread *self  G_GNUC_MAY_ALIAS; /* protected by mutex */
161:   GUPnPSimpleIgdThread *self = user_data;
177: stop_loop (GUPnPSimpleIgdThread *self)
352:   GUPnPSimpleIgdThread *self;
380:   GUPnPSimpleIgdThread *self;
405:   GUPnPSimpleIgdThread *self;
428:   GUPnPSimpleIgdThread *self;
544:  * Creates a new #GUPnPSimpleIgdThread
546:  * Returns: the new #GUPnPSimpleIgdThread
549: GUPnPSimpleIgdThread *
42:  * GUPnPSimpleIgdThreadClass:
83:    GUPnPSimpleIgdThreadPrivate))
github.com/google/skylark:eval.go: [ master, ]
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 { return thread.frame.parent }
70: func (thread *Thread) TopFrame() *Frame { return thread.frame }
117: // The Frames of a thread are structured as a spaghetti stack, not a
217: // Thread is the state associated with the Skylark thread.
231: func ExecFile(thread *Thread, filename string, src interface{}, predeclared StringDict) (StringDict, error) {
238: 	g, err := mod.Init(thread, predeclared)
280: func (prog *Program) Init(thread *Thread, predeclared StringDict) (StringDict, error) {
283: 	_, err := Call(thread, toplevel, nil, nil)
328: func Eval(thread *Thread, filename string, src interface{}, env StringDict) (Value, error) {
341: 	return Call(thread, fn, nil, nil)
724: 			needle, ok := x.(String)
728: 			return Bool(strings.Contains(string(y), string(needle))), nil
850: func Call(thread *Thread, fn Value, args Tuple, kwargs []Tuple) (Value, error) {
856: 	thread.frame = &Frame{parent: thread.frame, callable: c}
857: 	result, err := c.CallInternal(thread, args, kwargs)
858: 	thread.frame = thread.frame.parent
github.com/GNOME/pitivi:pitivi/utils/threads.py: [ mainline, ]
29: class Thread(threading.Thread, GObject.Object, Loggable):
72:     def add_thread(self, threadclass, *args):
65: class ThreadMaster(Loggable):
83:     def _thread_done_cb(self, thread):
87:     def wait_all_threads(self):
30:     """Event-powered thread."""
38:         threading.Thread.__init__(self)
42:         """Stops the thread, do not override."""
47:         """Runs the thread."""
52:         """Processes the thread.
59:         """Aborts the thread.
73:         """Instantiates the specified Thread class and starts it."""
74:         assert issubclass(threadclass, Thread)
75:         self.log("Adding thread of type %r", threadclass)
76:         thread = threadclass(*args)
77:         thread.connect("done", self._thread_done_cb)
78:         self.threads.append(thread)
80:         thread.start()
84:         self.log("thread %r is done", thread)
85:         self.threads.remove(thread)
92:             for thread in self.threads:
93:                 self.log("Waiting for thread to stop: %r", thread)
95:                     thread.join()
98:                     # Tried to join the current thread, or one
17: import threading
66:     """Threads controller."""
70:         self.threads = []
88:         """Waits until all running Threads controlled by this master stop."""
89:         self.log("Waiting for threads to stop")
91:         while joinedthreads < len(self.threads):
90:         joinedthreads = 0
96:                     joinedthreads += 1
android.googlesource.com/platform/external/rust/crates/syn:src/lib.rs: [ master, ]
797: mod thread;
139: //!     bad: std::thread::Thread,
149: //! error[E0277]: the trait bound `std::thread::Thread: HeapSize` is not satisfied
152: //! 7 |     bad: std::thread::Thread,
153: //!   |     ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HeapSize` is not implemented for `Thread`
266:     clippy::needless_doctest_main,
267:     clippy::needless_pass_by_value,
android.googlesource.com/platform/system/nfc:src/adaptation/NfcAdaptation.cc: [ master, ]
464: uint32_t NfcAdaptation::Thread(__attribute__((unused)) uint32_t arg) {
825: ThreadMutex::ThreadMutex() {
875: ThreadCondVar::ThreadCondVar() {
842: ThreadMutex::~ThreadMutex() { pthread_mutex_destroy(&mMutex); }
893: ThreadCondVar::~ThreadCondVar() { pthread_cond_destroy(&mCondVar); }
932: AutoThreadMutex::AutoThreadMutex(ThreadMutex& m) : mm(m) { mm.lock(); }
943: AutoThreadMutex::~AutoThreadMutex() { mm.unlock(); }
288:   // Android already logs thread_id, proc_id, timestamp, so disable those.
369:     GKI_create_task((TASKPTR)Thread, MMI_TASK, (int8_t*)"NFCA_THREAD", nullptr, 0,
431: ** Description: signal the CondVar to release the thread that is waiting
457: ** Function:    NfcAdaptation::Thread()
465:   const char* func = "NfcAdaptation::Thread";
61: ThreadMutex NfcAdaptation::sLock;
64: ThreadCondVar NfcAdaptation::mHalOpenCompletedEvent;
65: ThreadCondVar NfcAdaptation::mHalCloseCompletedEvent;
304:     // of a byte array is ambiguous and needlessly difficult to configure.
366:                   (pthread_cond_t*)nullptr, nullptr);
370:                     (pthread_cond_t*)nullptr, nullptr);
459: ** Description: Creates work threads
469:     ThreadCondVar CondVar;
472:                     (pthread_cond_t*)CondVar, (pthread_mutex_t*)CondVar);
818: ** Function:    ThreadMutex::ThreadMutex()
826:   pthread_mutexattr_t mutexAttr;
828:   pthread_mutexattr_init(&mutexAttr);
829:   pthread_mutex_init(&mMutex, &mutexAttr);
830:   pthread_mutexattr_destroy(&mutexAttr);
835: ** Function:    ThreadMutex::~ThreadMutex()
846: ** Function:    ThreadMutex::lock()
853: void ThreadMutex::lock() { pthread_mutex_lock(&mMutex); }
857: ** Function:    ThreadMutex::unblock()
864: void ThreadMutex::unlock() { pthread_mutex_unlock(&mMutex); }
868: ** Function:    ThreadCondVar::ThreadCondVar()
876:   pthread_condattr_t CondAttr;
878:   pthread_condattr_init(&CondAttr);
879:   pthread_cond_init(&mCondVar, &CondAttr);
881:   pthread_condattr_destroy(&CondAttr);
886: ** Function:    ThreadCondVar::~ThreadCondVar()
897: ** Function:    ThreadCondVar::wait()
904: void ThreadCondVar::wait() {
905:   pthread_cond_wait(&mCondVar, *this);
906:   pthread_mutex_unlock(*this);
911: ** Function:    ThreadCondVar::signal()
918: void ThreadCondVar::signal() {
920:   pthread_cond_signal(&mCondVar);
194:   AutoThreadMutex a(sLock);
368:     AutoThreadMutex guard(mCondVar);
389:   AutoThreadMutex a(sLock);
470:     AutoThreadMutex guard(CondVar);
919:   AutoThreadMutex a(*this);
925: ** Function:    AutoThreadMutex::AutoThreadMutex()
936: ** Function:    AutoThreadMutex::~AutoThreadMutex()
github.com/apache/commons-io:src/main/java/org/apache/commons/io/ThreadMonitor.java: [ master, ]
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/GNOME/niepce:src/fwk/utils/thread.hpp: [ mainline, ]
31: class Thread
43:     std::thread * thread() const
22: #define __FWK_UTILS_THREAD_H__
2:  * niepce - fwk/utils/thread.hpp
21: #ifndef __FWK_UTILS_THREAD_H__
26: #include <thread>
30: /** thread */
34:     Thread();
35:     virtual ~Thread();
46:     std::thread *       m_thrd;
go.googlesource.com/debug:internal/core/thread.go: [ master, ]
8: type Thread struct {
7: // A Thread represents an operating system thread.
9: 	pid  uint64   // thread/process ID
15: func (t *Thread) Pid() uint64 {
19: // Regs returns the set of register values for the thread.
23: func (t *Thread) Regs() []uint64 {
27: func (t *Thread) PC() Address {
31: func (t *Thread) SP() Address {
github.com/vanadium/core:x/ref/runtime/internal/testing/concurrency/thread.go: [ master, ]
40: type thread struct {
54: func newThread(tid TID, clock clock) *thread {
11: // TID is the thread identifier type.
14: // Increasing is used to sort thread identifiers in an increasing order.
29: // TIDGenerator is used for generating unique thread identifiers.
38: // thread records the abstract state of a thread during an execution
41: 	// tid is the thread identifier.
44: 	// this thread.
47: 	// thread.
49: 	// req holds the current scheduling request of the thread.
53: // newThread is the thread factory.
55: 	return &thread{
61: // enabled checks if the thread can be scheduled given the current
63: func (t *thread) enabled(ctx *context) bool {
65: 		panic(fmt.Sprintf("Thread %v has no request.", t.tid))
70: // kind returns the kind of the thread transition.
71: func (t *thread) kind() transitionKind {
73: 		panic(fmt.Sprintf("Thread %v has no request.", t.tid))
78: // readSet returns the set of abstract resources read by the thread.
79: func (t *thread) readSet() resourceSet {
81: 		panic(fmt.Sprintf("Thread %v has no request.", t.tid))
87: // thread.
88: func (t *thread) writeSet() resourceSet {
90: 		panic(fmt.Sprintf("Thread %v has no request.", t.tid))
github.com/apache/xerces2-j:tests/thread/Test.java: [ trunk, ]
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, ]
363:     private final Thread thread;
1245:         private boolean threadShouldExit(long now, long curHardShutdownTimeMs) {
316:     static final String NETWORK_THREAD_PREFIX = "kafka-admin-client-thread";
291:  * This class is thread-safe.
314:      * Thread name prefix for admin client network thread
356:      * The runnable used in the service thread for this admin client.
361:      * The network service thread for this admin client.
367:      * and force the RPC thread to exit. If the admin client is not closing, this will be 0.
372:      * A factory which creates TimeoutProcessors for the RPC thread.
580:         String threadName = NETWORK_THREAD_PREFIX + " | " + clientId;
581:         this.thread = new KafkaThread(threadName, runnable, true);
589:         thread.start();
633:                 client.wakeup(); // Wake the thread, if it is blocked inside poll().
645:             log.debug("Waiting for the I/O thread to exit. Hard shutdown in {} ms.", deltaMs);
648:             // close() can be called by AdminClient thread when it invokes callback. That will
650:             if (Thread.currentThread() != thread) {
651:                 // Wait for the thread to be joined.
652:                 thread.join(waitTimeMs);
656:             log.debug("Interrupted while joining I/O thread", e);
657:             Thread.currentThread().interrupt();
943:          * Only accessed from this thread.
949:          * Only accessed from this thread.
955:          * Only accessed from this thread.
961:          * Only accessed from this thread.
967:          * This will be null only if the thread has shut down.
1247:                 log.trace("All work has been completed, and the I/O thread is now exiting.");
1251:                 log.info("Forcing a hard I/O thread shutdown. Requests in progress will be aborted.");
1260:             log.trace("Thread starting");
1269:                     numTimedOut += timeoutProcessor.handleTimeouts(newCalls, "The AdminClient thread has exited.");
1272:                 numTimedOut += timeoutProcessor.handleTimeouts(pendingCalls, "The AdminClient thread has exited.");
1275:                         "The AdminClient thread has exited.");
1281:                 log.debug("Exiting AdminClientRunnable thread.");
1291:                 // Check if the AdminClient thread should shut down.
1346:          * If the AdminClient thread has exited, this will fail. Otherwise, it will succeed (even
1370:                 client.wakeup(); // wake the thread if it is in poll()
1372:                 log.debug("The AdminClient thread has exited. Timing out {}.", call);
1373:                 call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread has exited."));
1388:                 call.fail(Long.MAX_VALUE, new TimeoutException("The AdminClient thread is not accepting new calls."));
242: import org.apache.kafka.common.utils.KafkaThread;
1293:                 if ((curHardShutdownTimeMs != INVALID_SHUTDOWN_TIME) && threadShouldExit(now, curHardShutdownTimeMs))
github.com/kubernetes/minikube:site/package-lock.json: [ master, ]
1127:             "needle": "^2.2.1",
1108:         "needle": {
github.com/kubernetes/minikube:site/themes/docsy/userguide/package-lock.json: [ master, ]
1098:             "needle": "^2.2.1",
1079:         "needle": {
github.com/osxfuse/osxfuse:prefpane/externals/google-toolbox-for-mac/XcodePlugin/XcodeHeaders/DevToolsInterface.h: [ master, ]
4872: - (id)thread;
4528:     PBXLSThread *_selectedThread;
4540: - (id)selectedThread;
4689: - (id)threadViewModule;
4771: - (id)selectedThread;
4875: - (BOOL)threadIsRunning;
4876: - (BOOL)threadIsRunningButNotStepping;
4877: - (BOOL)threadStepDidTimeout;
4878: - (BOOL)threadIsSteppable;
4899: - (void)continueThread;
7806: + (void)_startCrashCatchingServiceThread;
11480: - (void)threadRequestUpdateStack:(id)fp8;
11481: - (void)threadRequestStepInstruction:(id)fp8;
11482: - (void)threadRequestNextInstruction:(id)fp8;
11483: - (void)threadRequestStepInto:(id)fp8;
11484: - (void)threadRequestStepOver:(id)fp8;
11485: - (void)threadRequestStepOut:(id)fp8;
11487: - (void)threadRequestContinue:(id)fp8;
11862:     PBXLSThread *_currentThread;
11876: - (id)currentThread;
11883: - (id)threadGroups;
11884: - (id)threadGroupWithName:(id)fp8;
11887: - (id)threads;
11888: - (id)threadWithHandle:(unsigned long)fp8;
11909: - (id)parentThread;
11923: - (void)threadDidUpdate;
11939: @interface PBXLSThread : PBXLSModel
11967: - (int)threadState;
11968: - (int)threadStateStatus;
11997: - (id)threads;
14973:     NSThread *_taskThread;
4527:     NSPopUpButtonCell *_threadsPopUp;
4539: - (void)selectThread:(id)fp8;
4544: - (void)setSelectedThread:(id)fp8;
4554:     PBXDebugThreadViewModule *_threadViewModule;
4770: - (void)setSelectedThread:(id)fp8;
4858:     PBXDebugStackTableHeaderCell *_threadsTablePopUp;
11885: - (id)_threadsOfType:(int)fp8;
11941:     int _threadState;
11943:     int _threadStateStatus;
558: - (BOOL)usesThreadedAnimation;
559: - (void)setUsesThreadedAnimation:(BOOL)fp8;
3033: - (void)_finishSpeculativeCompilationInSeparateThreadWithSpecCompInfo:(id)fp8;
4535: - (id)selectedThreadViewModule;
4537: - (BOOL)allThreadsStopped;
4541: - (void)_emptyThreadsPopUp;
4546: - (void)setThreadsPopUp:(id)fp8;
4552:     PBXDebugProcessAndThreadModule *_processAndThreadModule;
4851: @interface PBXDebugThreadViewModule : PBXDebugDSModelViewModule
4867: - (id)stackTableThreadsPopUp;
7563: @interface PBXDebugProcessAndThreadModule : PBXDebugViewModule
11457: - (void)destroyThreadWithThreadHandle:(unsigned long)fp8;
11461: - (void)willUpdateThreads;
11462: - (void)didUpdateThreads;
11505: - (oneway void)requestSuspendAllThreads;
11872: - (void)debuggerWillUpdateThreads:(id)fp8;
11881: - (void)debuggerDidUpdateThreads:(id)fp8;
11886: - (id)nonRunningThreads;
11958: - (id)parentThreadGroup;
11983: @interface PBXLSThreadGroup : PBXLSModel
13118: - (BOOL)usesThreadedAnimation;
13119: - (void)setUsesThreadedAnimation:(BOOL)fp8;
13379: + (BOOL)useThreadedAnimation;
20671: - (BOOL)usesThreadedAnimation;
20672: - (void)setUsesThreadedAnimation:(BOOL)fp8;
11458: - (id)threadGroupWithName:(id)fp8 create:(BOOL)fp12;
11459: - (oneway void)setState:(int)fp8 status:(int)fp12 isCurrentThread:(BOOL)fp16 forServerThreadHandle:(unsigned long)fp20;
11486: - (void)threadRequest:(byref id)fp8 stepUntilLineNumber:(unsigned int)fp12;
11494: - (void)requestDebuggerMovePCInThread:(unsigned long)fp8 fileSpec:(id)fp12;
11640: - (void)requestPrintDescriptionInThread:(id)fp8 atStackFrame:(id)fp12;
11875: - (void)debugger:(id)fp8 setCurrentThread:(id)fp12;
11995: - (void)debugger:(id)fp8 addThread:(id)fp12;
11996: - (void)debugger:(id)fp8 removeThread:(id)fp12;
11455: - (void)createThreadWithThreadHandle:(unsigned long)fp8 name:(id)fp12 inThreadGroupNamed:(id)fp16;
11873: - (void)debugger:(id)fp8 addThreadGroup:(id)fp12;
11874: - (void)debugger:(id)fp8 removeThreadGroup:(id)fp12;
11970: - (void)debugger:(id)fp8 setThreadState:(int)fp12 status:(int)fp16;
14988: - (BOOL)detachNewThreadSelector:(SEL)fp8 cancelSelector:(SEL)fp12 toTarget:(id)fp16 withObject:(id)fp20;
github.com/google/j2objc:jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java: [ master, ]
1695:         volatile Thread thread;
406:     static final class ThreadPerTaskExecutor implements Executor {
2647:             public Thread newThread(Runnable r) {
2646:         static final class DaemonThreadFactory implements ThreadFactory {
62:  * <em>non-async</em> methods may be performed by the thread that
69:  * which case, a new Thread is created to run each task).
76:  * class maintains at most one daemon thread for triggering and
174:      *   invocation if already claimed by another thread.
407:         public void execute(Runnable r) { new Thread(r).start(); }
530:          * thread claims ownership.  If async, starts as task -- a
1684:      * Completion for recording and releasing a waiting thread.  This
1698:             this.thread = Thread.currentThread();
1704:             Thread w; // no need to atomically claim
1705:             if ((w = thread) != null) {
1706:                 thread = null;
1712:             if (Thread.interrupted())
1718:                     thread == null);
1729:         final boolean isLive() { return thread != null; }
1761:             q.thread = null;
1766:                     Thread.currentThread().interrupt();
1779:         if (Thread.interrupted())
1805:                 q.thread = null;
1918:      * @throws InterruptedException if the current thread was interrupted
1935:      * @throws InterruptedException if the current thread was interrupted
2420:      * parallel thread, or else an Executor using one thread per async
2422:      * an Executor that provides at least one independent thread.
2648:                 Thread t = new Thread(r);
51:  * <p>When two or more threads attempt to
195:      * linked). Multiple threads can call postComplete, which
203:      * that wake up waiting threads.  The mechanics are similar to
213:      * threads nulling out fields.  We also try to unlink fired
216:      * volatile because they are only visible to other threads upon
403:         ForkJoinPool.commonPool() : new ThreadPerTaskExecutor();
1743:                 if (ThreadLocalRandom.nextSecondarySeed() >= 0)
2655:         static final ScheduledThreadPoolExecutor delayer;
2657:             (delayer = new ScheduledThreadPoolExecutor(
2658:                 1, new DaemonThreadFactory())).
github.com/angular/material-start:package-lock.json: [ master, ]
1624:             "needle": "^2.2.1",
1605:         "needle": {
github.com/apache/beam:website/www/site/themes/docsy/userguide/package-lock.json: [ master, ] Duplicate result
github.com/google/binnavi:debug/client/windynamorio/drdebug.proto: [ master, ]
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/GNOME/gimp:tools/performance-log-viewer.py: [ mainline, ]
285: Thread = namedtuple ("Thread", ("id", "name", "state", "frames"))
744:                 def thread (id, state = None):
734:                 def match_thread (thread, id, state = None):
2930:         def thread_filter_source_get (self):
2933:         def thread_filter_source_set (self, thread_filter):
2940:         def thread_filter_button_toggled (self, button):
275: class ThreadState (enum.Enum):
1955:     class ThreadStore (Gtk.ListStore):
2237:     def threads_row_activated (self, tree, path, col):
2257:     def threads_selection_changed (self, tree_sel):
2433:     class ThreadFilter (Gtk.TreeView):
2557:     class ThreadPopover (Gtk.Popover):
312:             for thread in element.find ("backtrace").iterfind ("thread"):
313:                 id      = thread.get ("id")
314:                 name    = thread.get ("name")
315:                 running = thread.get ("running")
317:                 t = Thread (
325:                 for frame in thread.iterfind ("frame"):
722:             f = eval ("lambda thread, function, %s: %s" % (
737:                              id == thread.id)                 or  \
739:                              thread.name                      and \
740:                              re.fullmatch (id, thread.name))) and \
742:                             re.fullmatch (state, str (thread.state)))
745:                     return any (match_thread (thread, id, state)
746:                                 for thread in samples[i].backtrace or [])
749:                     for thread in samples[i].backtrace or []:
750:                         if match_thread (thread, id, state):
751:                             for frame in thread.frames:
757:                 if f (thread, function, **{
2024:         self.thread_store = store
2028:         self.thread_tree = tree
2205:         sel_rows = self.thread_tree.get_selection ().get_selected_rows ()[1]
2208:             tid = self.thread_store[sel_rows[0]][self.ThreadStore.ID]
2212:         self.thread_store.clear ()
2215:             thread = samples[i].backtrace[t]
2217:             iter = self.thread_store.append (
2218:                 (t, thread.id, thread.name, str (thread.state))
2221:             if thread.id == tid:
2222:                 self.thread_tree.get_selection ().select_iter (iter)
2238:         iter = self.thread_store.get_iter (path)
2240:         tid = self.thread_store[iter][self.ThreadStore.ID]
2245:             threads = filter (lambda thread:
2246:                                 thread.id    == tid and
2247:                                 thread.state == ThreadState.RUNNING,
2298:             for thread in sample.backtrace or []:
2299:                 for frame in thread.frames:
2446:                 threads = list ({thread.id
2448:                                  for thread in sample.backtrace or ()})
2532:             threads = {thread.id: thread.name
2534:                        for thread in samples[i].backtrace or ()}
2574:             thread_filter = ProfileViewer.ThreadFilter ()
2575:             self.thread_filter = thread_filter
2576:             scrolled.add (thread_filter)
2577:             thread_filter.show ()
2640:                 thread_filter_store = popover.thread_filter.store
2642:                 self.thread_filter_store = thread_filter_store
2643:                 self.thread_filter       = thread_filter_store.get_filter ()
2645:                 history.add_source (self.thread_filter_source_get,
2646:                                     self.thread_filter_source_set)
2652:                 button.connect ("toggled", self.thread_filter_button_toggled)
2762:                 for thread in samples[i].backtrace or []:
2763:                     if thread.state in self.thread_filter[thread.id]:
2764:                         thread_frames = thread.frames
2767:                             thread_frames = reversed (thread_frames)
2772:                         for frame in thread_frames:
2931:             return self.thread_filter_store.get_filter ()
2934:             self.thread_filter = thread_filter
2936:             self.thread_filter_store.set_filter (thread_filter)
2942:                 thread_filter = self.thread_filter_store.get_filter ()
2944:                 if thread_filter != self.thread_filter:
2945:                     self.thread_filter = thread_filter
281:             ThreadState.SUSPENDED: "S",
282:             ThreadState.RUNNING:   "R"
320:                     state  = ThreadState.RUNNING if running and int (running) \
321:                              else ThreadState.SUSPENDED,
2012:         header = Gtk.HeaderBar (title = "Threads", has_subtitle = False)
2023:         store = self.ThreadStore ()
2033:         tree.connect ("row-activated", self.threads_row_activated)
2036:                                        self.threads_selection_changed)
2044:         col.add_attribute (cell, "text", self.ThreadStore.ID)
2052:         col.add_attribute (cell, "text", self.ThreadStore.NAME)
2060:         col.add_attribute (cell, "text", self.ThreadStore.STATE)
2250:             if list (threads):
2438:             STATE   = {list (ThreadState)[i]: 3 + i
2439:                        for i in range (len (ThreadState))}
2449:                 threads.sort ()
2451:                 states = [state == ThreadState.RUNNING for state in self.STATE]
2453:                 for id in threads:
2539:                 if id in threads:
2541:                     row[self.store.NAME]    = threads[id]
2638:                 popover = ProfileViewer.ThreadPopover ()
2659:                 label = Gtk.Label (label = "Threads")
github.com/google/skia:modules/canvaskit/package-lock.json: [ master, ]
1560:             "needle": "^2.2.1",
1541:         "needle": {
github.com/google/guava:guava/src/com/google/common/util/concurrent/AbstractFuture.java: [ master, ]
194:     volatile @Nullable Thread thread;
1227:     abstract void putThread(Waiter waiter, Thread newValue);
1297:     void putThread(Waiter waiter, Thread newValue) {
1347:     void putThread(Waiter waiter, Thread newValue) {
1380:     void putThread(Waiter waiter, Thread newValue) {
1253:     static final long WAITER_THREAD_OFFSET;
1327:     final AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater;
160:                 newUpdater(Waiter.class, Thread.class, "thread"),
205:       ATOMIC_HELPER.putThread(this, Thread.currentThread());
216:       // unpark even though the thread has already removed itself from the list. But even if we did
218:       Thread w = thread;
220:         thread = null;
232:    *   <li>This is only called when a waiting thread times out or is interrupted. Both of which
238:     node.thread = null; // mark as 'deleted'
249:         if (curr.thread != null) { // we aren't unlinking this node, update pred.
253:           if (pred.thread == null) { // We raced with another node that unlinked pred. Restart.
387:   //   have observed 12 micros on 64 bit linux systems to wake up a parked thread). So if the
404:    * current thread is interrupted during the call, even if the value is already available.
416:     if (Thread.interrupted()) {
436:               if (Thread.interrupted()) {
451:                 // Remove the waiter, one way or another we are done parking this thread.
471:       if (Thread.interrupted()) {
515:    * current thread is interrupted during the call, even if the value is already available.
522:     if (Thread.interrupted()) {
539:             if (Thread.interrupted()) {
943:         Thread.currentThread().interrupt();
1192:     // arbitrary cycles using a thread local but this should be a good enough solution (it is also
1226:     /** Non volatile write of the thread to the {@link Waiter#thread} field. */
1287:         WAITER_THREAD_OFFSET = unsafe.objectFieldOffset(Waiter.class.getDeclaredField("thread"));
1298:       UNSAFE.putObject(waiter, WAITER_THREAD_OFFSET, newValue);
1334:         AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater,
1381:       waiter.thread = newValue;
370:   /** All waiting threads. */
948:   /** Unblocks all threads and runs all listeners. */
1047:   /** Releases all threads in the {@link #waiters} list, and clears the list. */
1339:       this.waiterThreadUpdater = waiterThreadUpdater;
1348:       waiterThreadUpdater.lazySet(waiter, newValue);
github.com/google/binnavi:debug/client/defs.hpp: [ master, ]
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/google/guava:android/guava/src/com/google/common/util/concurrent/AbstractFuture.java: [ master, ]
194:     @NullableDecl volatile Thread thread;
1229:     abstract void putThread(Waiter waiter, Thread newValue);
1299:     void putThread(Waiter waiter, Thread newValue) {
1349:     void putThread(Waiter waiter, Thread newValue) {
1382:     void putThread(Waiter waiter, Thread newValue) {
1255:     static final long WAITER_THREAD_OFFSET;
1329:     final AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater;
160:                 newUpdater(Waiter.class, Thread.class, "thread"),
205:       ATOMIC_HELPER.putThread(this, Thread.currentThread());
216:       // unpark even though the thread has already removed itself from the list. But even if we did
218:       Thread w = thread;
220:         thread = null;
232:    *   <li>This is only called when a waiting thread times out or is interrupted. Both of which
238:     node.thread = null; // mark as 'deleted'
249:         if (curr.thread != null) { // we aren't unlinking this node, update pred.
253:           if (pred.thread == null) { // We raced with another node that unlinked pred. Restart.
387:   //   have observed 12 micros on 64 bit linux systems to wake up a parked thread). So if the
404:    * current thread is interrupted during the call, even if the value is already available.
416:     if (Thread.interrupted()) {
436:               if (Thread.interrupted()) {
451:                 // Remove the waiter, one way or another we are done parking this thread.
471:       if (Thread.interrupted()) {
515:    * current thread is interrupted during the call, even if the value is already available.
522:     if (Thread.interrupted()) {
539:             if (Thread.interrupted()) {
943:         Thread.currentThread().interrupt();
1194:     // arbitrary cycles using a thread local but this should be a good enough solution (it is also
1228:     /** Non volatile write of the thread to the {@link Waiter#thread} field. */
1289:         WAITER_THREAD_OFFSET = unsafe.objectFieldOffset(Waiter.class.getDeclaredField("thread"));
1300:       UNSAFE.putObject(waiter, WAITER_THREAD_OFFSET, newValue);
1336:         AtomicReferenceFieldUpdater<Waiter, Thread> waiterThreadUpdater,
1383:       waiter.thread = newValue;
370:   /** All waiting threads. */
948:   /** Unblocks all threads and runs all listeners. */
1048:   /** Releases all threads in the {@link #waiters} list, and clears the list. */
1341:       this.waiterThreadUpdater = waiterThreadUpdater;
1350:       waiterThreadUpdater.lazySet(waiter, newValue);
github.com/GoogleCloudPlatform/training-data-analyst:blogs/microservices-demo-1/src/paymentservice/package-lock.json: [ master, ]
1058:             "needle": "^2.2.0",
1043:         "needle": {
github.com/GoogleCloudPlatform/training-data-analyst:blogs/microservices-demo-1/src/currencyservice/package-lock.json: [ master, ]
1036:             "needle": "^2.2.0",
1021:         "needle": {
github.com/kubernetes/website:themes/docsy/userguide/package-lock.json: [ master, ]
1098:             "needle": "^2.2.1",
1079:         "needle": {
github.com/GNOME/gimp:app/widgets/gimpdashboard.c: [ mainline, ]
299:   GThread                      *thread;
146:   VARIABLE_ASSIGNED_THREADS,
147:   VARIABLE_ACTIVE_THREADS,
1254:   /* sampler thread
1256:    * we use a separate thread for sampling, so that data is sampled even when
1257:    * the main thread is busy
1259:   priv->thread = g_thread_new ("dashboard",
1374:   if (priv->thread)
1383:       g_clear_pointer (&priv->thread, g_thread_join);
3660:       gint     thread;
3681:           for (thread = 0; thread < n_threads; thread++)
3683:               guintptr thread_id;
3685:               thread_id = gimp_backtrace_get_thread_id (priv->log_backtrace,
3686:                                                         thread);
3688:               if (gimp_backtrace_find_thread_by_id (backtrace,
3689:                                                     thread_id, thread) < 0)
3691:                   const gchar *thread_name;
3695:                   thread_name =
3696:                     gimp_backtrace_get_thread_name (priv->log_backtrace,
3697:                                                     thread);
3700:                                              "<thread id=\"%llu\"",
3701:                                              (unsigned long long) thread_id);
3703:                   if (thread_name)
3707:                       gimp_dashboard_log_print_escaped (dashboard, thread_name);
3720:       for (thread = 0; thread < n_threads; thread++)
3722:           guintptr     thread_id;
3723:           const gchar *thread_name;
3732:           thread_id   = gimp_backtrace_get_thread_id     (backtrace, thread);
3733:           thread_name = gimp_backtrace_get_thread_name   (backtrace, thread);
3735:           running     = gimp_backtrace_is_thread_running (backtrace, thread);
3736:           n_frames    = gimp_backtrace_get_n_frames      (backtrace, thread);
3740:               gint other_thread = gimp_backtrace_find_thread_by_id (
3741:                 priv->log_backtrace, thread_id, thread);
3743:               if (other_thread >= 0)
3748:                   last_running  = gimp_backtrace_is_thread_running (
3749:                     priv->log_backtrace, other_thread);
3751:                     priv->log_backtrace, other_thread);
3758:                                                             thread, i) !=
3760:                                                             other_thread, i))
3772:                                                             thread, -i - 1) !=
3774:                                                             other_thread, -i - 1))
3794:                                      "<thread id=\"%llu\"",
3795:                                      (unsigned long long) thread_id);
3797:           if (thread_name)
3801:               gimp_dashboard_log_print_escaped (dashboard, thread_name);
3834:                                                               thread, frame);
3844:                                          "</thread>\n");
694:   [VARIABLE_ASSIGNED_THREADS] =
695:   { .name             = "assigned-threads",
697:     .description      = N_("Number of assigned worker threads"),
700:     .data             = "assigned-threads"
703:   [VARIABLE_ACTIVE_THREADS] =
704:   { .name             = "active-threads",
706:     .description      = N_("Number of active worker threads"),
709:     .data             = "active-threads"
949:                           { .variable       = VARIABLE_ASSIGNED_THREADS,
952:                           { .variable       = VARIABLE_ACTIVE_THREADS,
3659:       gint     n_threads;
3679:           n_threads = gimp_backtrace_get_n_threads (priv->log_backtrace);
3718:       n_threads = gimp_backtrace_get_n_threads (backtrace);
1260:                                (GThreadFunc) gimp_dashboard_sample,
github.com/google/gapid:gapis/service/service.proto: [ master, ]
101:     Thread thread = 18;
892: message Thread {
78: message Threads {
102:     Threads threads = 19;
79:   repeated path.Thread list = 1;
891: // Thread represents a single thread in the capture.
github.com/libgit2/objective-git:External/libgit2/src/pack-objects.c: [ master, ]
1110: 	git_thread thread;
1109: struct thread_params {
1127: static void *threaded_find_deltas(void *arg)
183: unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
15: #include "thread-utils.h"
155: 	pb->nr_threads = 1; /* do not spawn any thread by default */
1129: 	struct thread_params *me = arg;
1143: 			git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
1152: 		 * condition because the main thread may have set it to 1
1155: 		 * was initialized to 0 before this thread was spawned
1168: 	struct thread_params *p;
1219: 		ret = git_thread_create(&p[i].thread,
1222: 			git_error_set(GIT_ERROR_THREAD, "unable to create thread");
1229: 	 * Now let's wait for work completion.  Each time a thread is done
1231: 	 * thread with the largest number of unprocessed objects and give
1232: 	 * it to that newly idle thread.  This ensure good load balancing
1237: 		struct thread_params *target = NULL;
1238: 		struct thread_params *victim = NULL;
1241: 		/* Start by locating a thread that has transitioned its
1256: 		 * a thread to receive more work. We still need to locate a
1257: 		 * thread from which to steal work (the victim). */
1291: 			git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
1301: 			git_thread_join(&target->thread, NULL);
50: #ifdef GIT_THREADS
62: #endif /* GIT_THREADS */
163: #ifdef GIT_THREADS
187: #ifdef GIT_THREADS
188: 	pb->nr_threads = n;
191: 	assert(1 == pb->nr_threads);
194: 	return pb->nr_threads;
1033: 		 * it anyway, and doing it here while we're threaded will
1034: 		 * save a lot of time in the non threaded write phase,
1107: #ifdef GIT_THREADS
1170: 	int ret, active_threads = 0;
1172: 	if (!pb->nr_threads)
1173: 		pb->nr_threads = git_online_cpus();
1175: 	if (pb->nr_threads <= 1) {
1180: 	p = git__mallocarray(pb->nr_threads, sizeof(*p));
1183: 	/* Partition the work among the threads */
1184: 	for (i = 0; i < pb->nr_threads; ++i) {
1185: 		size_t sub_size = list_size / (pb->nr_threads - i);
1188: 		if (sub_size < 2*window && i+1 < pb->nr_threads)
1211: 	/* Start work threads */
1212: 	for (i = 0; i < pb->nr_threads; ++i) {
1220: 					threaded_find_deltas, &p[i]);
1225: 		active_threads++;
1236: 	while (active_threads) {
1247: 			for (i = 0; !target && i < pb->nr_threads; i++)
1258: 		for (i = 0; i < pb->nr_threads; i++)
1304: 			active_threads--;
1773: #ifdef GIT_THREADS
github.com/firebase/firebase-android-sdk:firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/device/session/Crashlytics.java: [ master, ]
9211:           public static final class Thread extends com.google.protobuf.GeneratedMessage
9214:             private Thread(Builder builder) {
9218:             private Thread(boolean noInit) {}
225:     IN_CRASHED_THREAD(2, 4),
9143:           public interface ThreadOrBuilder extends com.google.protobuf.MessageOrBuilder {
15726:           public static final int THREADS_FIELD_NUMBER = 1;
15730:               threads_;
16412:                 threads_ = java.util.Collections.emptyList();
16431:                 threadsBuilder_;
234:     public static final int IN_CRASHED_THREAD_VALUE = 4;
26002:       internal_static_Crashlytics_Session_Event_Application_Execution_Thread_descriptor;
26004:       internal_static_Crashlytics_Session_Event_Application_Execution_Thread_fieldAccessorTable;
26006:       internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Frame_descriptor;
26008:       internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Frame_fieldAccessorTable;
26010:       internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Register_descriptor;
26012:       internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Register_fieldAccessorTable;
9050:               getThreadsList();
9054:               getThreads(int index);
9056:           int getThreadsCount();
9062:               getThreadsOrBuilderList();
9066:               getThreadsOrBuilder(int index);
15735:               getThreadsList() {
15743:               getThreadsOrBuilderList() {
15747:           public int getThreadsCount() {
15753:               getThreads(int index) {
15759:               getThreadsOrBuilder(int index) {
16414:             private void ensureThreadsIsMutable() {
16436:                 getThreadsList() {
16444:             public int getThreadsCount() {
16454:                 getThreads(int index) {
16462:             public Builder setThreads(
16480:             public Builder setThreads(
16495:             public Builder addThreads(
16512:             public Builder addThreads(
16530:             public Builder addThreads(
16544:             public Builder addThreads(
16559:             public Builder addAllThreads(
16575:             public Builder clearThreads() {
16586:             public Builder removeThreads(int index) {
16599:                 getThreadsBuilder(int index) {
16605:                 getThreadsOrBuilder(int index) {
16617:                 getThreadsOrBuilderList() {
16627:                 addThreadsBuilder() {
16636:                 addThreadsBuilder(int index) {
16647:                 getThreadsBuilderList() {
16658:                 getThreadsFieldBuilder() {
251:           return IN_CRASHED_THREAD;
293:       IN_CRASHED_THREAD,
9046:           // repeated .Crashlytics.Session.Event.Application.Execution.Thread threads = 1;
9049:                       .Application.Execution.Thread>
9053:                   .Execution.Thread
9155:             // repeated .Crashlytics.Session.Event.Application.Execution.Thread.Frame frames = 3;
9158:                         .Application.Execution.Thread.Frame>
9162:                     .Execution.Thread.Frame
9170:                             .Application.Execution.Thread.FrameOrBuilder>
9174:                     .Execution.Thread.FrameOrBuilder
9177:             // repeated .Crashlytics.Session.Event.Application.Execution.Thread.Register registers =
9181:                         .Application.Execution.Thread.Register>
9185:                     .Execution.Thread.Register
9193:                             .Application.Execution.Thread.RegisterOrBuilder>
9197:                     .Execution.Thread.RegisterOrBuilder
9213:             // Use Thread.newBuilder() to construct.
9220:             private static final Thread defaultInstance;
9222:             public static Thread getDefaultInstance() {
9226:             public Thread getDefaultInstanceForType() {
9232:                   .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_descriptor;
9238:                   .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_fieldAccessorTable;
9320:                     .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Frame_descriptor;
9326:                     .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Frame_fieldAccessorTable;
9677:                       .Application.Execution.Thread.Frame
9684:                       .Application.Execution.Thread.Frame
9693:                       .Application.Execution.Thread.Frame
9699:                       .Application.Execution.Thread.Frame
9707:                       .Application.Execution.Thread.Frame
9713:                       .Application.Execution.Thread.Frame
9722:                       .Application.Execution.Thread.Frame
9733:                       .Application.Execution.Thread.Frame
9747:                       .Application.Execution.Thread.Frame
9753:                       .Application.Execution.Thread.Frame
9771:                           .Application.Execution.Thread.Frame
9790:                       .Event.Application.Execution.Thread.FrameOrBuilder {
9793:                       .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Frame_descriptor;
9799:                       .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Frame_fieldAccessorTable;
9803: ...(14 bytes skipped)...  // com.google.firebase.crashlytics.device.session.Crashlytics.Session.Event.Application.Execution.Thread.Frame.newBuilder()
9854:                       .Application.Execution.Thread.Frame.getDescriptor();
9858:                         .Application.Execution.Thread.Frame
9861:                       .Application.Execution.Thread.Frame.getDefaultInstance();
9865:                         .Application.Execution.Thread.Frame
9868:                           .Application.Execution.Thread.Frame
9877:                         .Application.Execution.Thread.Frame
9880:                           .Application.Execution.Thread.Frame
9890:                         .Application.Execution.Thread.Frame
9893:                           .Application.Execution.Thread.Frame
9896:                               .Event.Application.Execution.Thread.Frame(this);
9952:                           .Application.Execution.Thread.Frame) {
9955:                                 .Application.Execution.Thread.Frame)
9965:                             .Application.Execution.Thread.Frame
9969:                           .Application.Execution.Thread.Frame.getDefaultInstance()) return this;
10450: ...(6 bytes skipped)...          // @@protoc_insertion_point(builder_scope:Crashlytics.Session.Event.Application.Execution.Thread.Frame)
10458: ...(2 bytes skipped)...            // @@protoc_insertion_point(class_scope:Crashlytics.Session.Event.Application.Execution.Thread.Frame)
10495:                     .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Register_descriptor;
10501:                     .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Register_fieldAccessorTable;
10612:                       .Application.Execution.Thread.Register
10619:                       .Application.Execution.Thread.Register
10628:                       .Application.Execution.Thread.Register
10634:                       .Application.Execution.Thread.Register
10642:                       .Application.Execution.Thread.Register
10648:                       .Application.Execution.Thread.Register
10657:                       .Application.Execution.Thread.Register
10668:                       .Application.Execution.Thread.Register
10682:                       .Application.Execution.Thread.Register
10688:                       .Application.Execution.Thread.Register
10706:                           .Application.Execution.Thread.Register
10725:                       .Event.Application.Execution.Thread.RegisterOrBuilder {
10728:                       .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Register_descriptor;
10734:                       .internal_static_Crashlytics_Session_Event_Application_Execution_Thread_Register_fieldAccessorTable;
10738: ...(14 bytes skipped)...  // com.google.firebase.crashlytics.device.session.Crashlytics.Session.Event.Application.Execution.Thread.Register.newBuilder()
10771:                       .Application.Execution.Thread.Register.getDescriptor();
10775:                         .Application.Execution.Thread.Register
10778:                       .Application.Execution.Thread.Register.getDefaultInstance();
10782:                         .Application.Execution.Thread.Register
10785:                           .Application.Execution.Thread.Register
10794:                         .Application.Execution.Thread.Register
10797:                           .Application.Execution.Thread.Register
10807:                         .Application.Execution.Thread.Register
10810:                           .Application.Execution.Thread.Register
10813:                               .Event.Application.Execution.Thread.Register(this);
10833:                           .Application.Execution.Thread.Register) {
10836:                                 .Application.Execution.Thread.Register)
10846:                             .Application.Execution.Thread.Register
10850:                           .Application.Execution.Thread.Register.getDefaultInstance()) return this;
10981: ...(6 bytes skipped)...          // @@protoc_insertion_point(builder_scope:Crashlytics.Session.Event.Application.Execution.Thread.Register)
10989: ...(2 bytes skipped)...            // @@protoc_insertion_point(class_scope:Crashlytics.Session.Event.Application.Execution.Thread.Register)
11039:             // repeated .Crashlytics.Session.Event.Application.Execution.Thread.Frame frames = 3;
11043:                         .Application.Execution.Thread.Frame>
11048:                         .Application.Execution.Thread.Frame>
11056:                             .Application.Execution.Thread.FrameOrBuilder>
11066:                     .Application.Execution.Thread.Frame
11072:                     .Application.Execution.Thread.FrameOrBuilder
11077:             // repeated .Crashlytics.Session.Event.Application.Execution.Thread.Register registers =
11082:                         .Application.Execution.Thread.Register>
11087:                         .Application.Execution.Thread.Register>
11095:                             .Application.Execution.Thread.RegisterOrBuilder>
11105:                     .Application.Execution.Thread.Register
11111:                     .Application.Execution.Thread.RegisterOrBuilder
11286:                     .Application.Execution.Thread
11293:                     .Application.Execution.Thread
11302: