Search some code: Max results:

Found 148010 results in 29766 files (34MB index data, 5827721 ngram matches, 654559 docs considered, 79615 docs (1069MB) loaded, 573682 docs skipped): for
(or substr:"thread" substr:"needle") with options &zoekt.SearchOptions{EstimateDocCount:false, Whole:false, ShardMaxMatchCount:250, TotalMaxMatchCount:1000000, ShardMaxImportantMatch:2, TotalMaxImportantMatch:100, MaxWallTime:10000000000}
in 4.795481238s (queued: 1.484┬Ás)

github.com/fuchsia-mirror/magenta-benchmarks:threads.cc:[master, ]

9: class Thread : public benchmark::Fixture {
31: BENCHMARK_F(Thread, Create)(benchmark::State& state) {
33:   static const char tname[] = "test thread";
35:     if (mx_thread_create(proc, tname, sizeof(tname), 0, &out) != MX_OK) {
36:       state.SkipWithError("Failed to create thread");
chromium.googlesource.com/external/mockito/mockito:src/main/java/org/mockito/internal/util/concurrent/DetachedThreadLocal.java:[master, ]
136:         THREAD, INLINE, MANUAL
14: public class DetachedThreadLocal<T> implements Runnable {
18:     public DetachedThreadLocal(Cleaner cleaner) {
9:  * A detached local that allows for explicit control of setting and removing values from a thread-local
12:  * Instances of this class are non-blocking and fully thread safe.
16:     final WeakConcurrentMap<Thread, T> map;
20:             case THREAD:
22:                 map = new WeakConcurrentMap<Thread, T>(cleaner == Cleaner.THREAD) {
24:                     protected T defaultValue(Thread key) {
30:                 map = new WeakConcurrentMap.WithInlinedExpunction<Thread, T>() {
32:                     protected T defaultValue(Thread key) {
43:         return map.get(Thread.currentThread());
47:         map.put(Thread.currentThread(), value);
51:         map.remove(Thread.currentThread());
55:      * Clears all thread local references for all threads.
62:      * @param thread The thread to which this thread's thread local value should be pushed.
65:     public T pushTo(Thread thread) {
68:             map.put(thread, inheritValue(value));
74:      * @param thread The thread from which the thread thread local value should be fetched.
77:     public T fetchFrom(Thread thread) {
78:         T value = map.get(thread);
86:      * @param thread The thread for which to set a thread-local value.
87:      * @return The value accociated with this thread.
89:     public T get(Thread thread) {
90:         return map.get(thread);
94:      * @param thread The thread for which to set a thread-local value.
97:     public void define(Thread thread, T value) {
98:         map.put(thread, value);
102:      * @param thread The thread for which an initial value is created.
103:      * @return The initial value for any thread local. If no default is set, the default value is {@code null}.
105:     protected T initialValue(Thread thread) {
118:      * @return The weak map that backs this detached thread local.
120:     public WeakConcurrentMap<Thread, T> getBackingMap() {
130:      * Determines the cleaning format. A reference is removed either by an explicitly started cleaner thread
131:      * associated with this instance ({@link Cleaner#THREAD}), as a result of interacting with this thread local
132:      * from any thread ({@link Cleaner#INLINE} or manually by submitting the detached thread local to a thread
25:                         return DetachedThreadLocal.this.initialValue(key);
33:                         return DetachedThreadLocal.this.initialValue(key);
android.googlesource.com/platform/external/mockito:src/main/java/org/mockito/internal/util/concurrent/DetachedThreadLocal.java:[master, ]
duplicate result
android.googlesource.com/platform/tools/gpu:cc/gapic/thread.h:[master, ]
25: class Thread {
39: inline Thread::Thread(uint64_t id) : mId(id) {}
18: #define GAPIC_THREAD_H
17: #ifndef GAPIC_THREAD_H
24: // Thread represents a single thread of execution in the process.
27:     // current returns the Thread representing the current thread of execution.
28:     static Thread current();
30:     // id returns the process-unique identifier for the Thread.
34:     inline Thread(uint64_t id);
41: inline uint64_t Thread::id() const {
47: #endif // GAPIC_THREAD_H
chromium.googlesource.com/chromiumos/third_party/opencryptoki:testcases/rsa_test/rsa_thread_test.c:[master, ]
77: typedef struct  Thread {
86: } Thread_t;
100: thread_func( void * thid)
89: Thread_t  *threads;
90: unsigned int THREADCNT=NUMTHREADS;
410: long rsa_thread_process_time(SYSTEMTIME t1, SYSTEMTIME t2)
88: #define NUMTHREADS  3
27: long rsa_thread_process_time(SYSTEMTIME t1, SYSTEMTIME t2);
103:    Thread_t *id;
106:    id = (Thread_t *)thid;
383:    diff = rsa_thread_process_time(t1,t2);
494:    threads = (Thread_t *)malloc(sizeof(Thread_t) * THREADCNT);
499: 		//      printf("Creating thread %d\n",threads[i].id);
500: 		pthread_create(&threads[i].tid,NULL,(void*(*)(void *))thread_func,
502: 		//      printf("Creating thread tid %d\n",threads[i].tid);
505: 		//   printf("Joining thread %d\n",threads[i].id);
507: 		printf("Thread[%d] took %d ms for %d operations %6f OP/ms   \n",
75: #include <pthread.h>
78:    pthread_t   tid;
367:       if (debug) printf("%d ",(int)threads[index].tid);
384:    threads[index].total = diff;
385:    threads[index].processed = loopcount - failed;
386:    threads[index].ops = (float) ((float)(loopcount - failed) / (float)diff);
447:       if (strcmp(argv[i], "-threads") == 0) {
448:          THREADCNT = atoi(argv[i+1]);
449:          printf("THREADS %d \n", THREADCNT);
462: 			printf("usage:  %s [-loop <num>] [-threads <num>] [-noskip]"
497: 	for (i=0; i<(int)THREADCNT; i++){
498: 		threads[i].id = i;
501: 				(void *)&(threads[i]));
504: 	for (i=0; i<(int)THREADCNT; i++){
506: 		pthread_join(threads[i].tid,NULL);
508: 		       i, (int)threads[i].total, (int)threads[i].processed,
509: 		       threads[i].ops);
github.com/googlecreativelab/chrome-music-lab:harmonics & strings/js/Thread.js:[master, ]
5: var Thread = function(xp0Pm, yp0Pm, xp1Pm, yp1Pm, indPm, indHarmonicPm, isTopPm, threadControllerPm) {
1: // class:	Thread
52: 	// how close do we have to be to instantly grab a thread - perpendicular distance (px)
60: 	// total length of this thread (when unstretched)
131: Thread.prototype.init = function() {
140: Thread.prototype.redraw = function() {
185: Thread.prototype.upd = function() {
186: 	// is thread currently grabbed
189: 	// is thread currently oscillating
198: Thread.prototype.updOsc = function() {
248: Thread.prototype.updGrab = function() {
250: 	// is this thread being held by a fish?
291: Thread.prototype.stopNote = function() {
298: Thread.prototype.pluck = function(xp, yp, byUser, fish) {
366: Thread.prototype.grab = function(xp, yp, byUser, car) {
386: Thread.prototype.drop = function() {
416: Thread.prototype.startOsc = function() {
430: Thread.prototype.playNote = function(vol, pan) {
445: Thread.prototype.setStretch = function(r) {
452: // desc:      Check when user first clicks if they clicked right on top of a thread,
455: Thread.prototype.checkInstantGrab = function() {
479: // desc:      Check when user first clicks if they clicked right on top of a thread,
482: Thread.prototype.setPosition = function(x0, y0, x1, y1) {
6: 	this.m = threadControllerPm;
67: 	// my overall index number of all threads
278: 		this.m.dropThread(this);
474: 		this.m.grabThread(this, xu, yu, true, null);
github.com/fuchsia-mirror/third_party-re2:re2/nfa.cc:[master, ]
64:   struct Thread {
88:   typedef SparseArray<Thread*> Threadq;
165: NFA::Thread* NFA::AllocThread() {
129:   Thread* free_threads_;  // free list
206: void NFA::AddToThreadq(Threadq* q, int id0, int c, int flag,
67:       Thread* next;  // when on free list
75:     Thread* t;  // if not null, set t0 = t before processing id
81:     AddState(int id, Thread* t)
90:   inline Thread* AllocThread();
91:   inline Thread* Incref(Thread* t);
92:   inline void Decref(Thread* t);
97:   // p is the current input position, and t0 is the current thread.
99:                     const char* p, Thread* t0);
157:   Thread* next;
158:   for (Thread* t = free_threads_; t; t = next) {
166:   Thread* t = free_threads_;
168:     t = new Thread;
178: NFA::Thread* NFA::Incref(Thread* t) {
184: void NFA::Decref(Thread* t) {
205: // p is the current input position, and t0 is the current thread.
207:                        const char* p, Thread* t0) {
228:       // t0 was a thread that we allocated and copied in order to
248:     Thread** tp = &q->find(id)->second;
250:     Thread* t;
338:     Thread* t = i->second;
435: // Returns whether haystack contains needle's memory.
436: static bool StringPieceContains(const StringPiece haystack, const StringPiece needle) {
437:   return haystack.begin() <= needle.begin() &&
438:          haystack.end() >= needle.end();
548:         Thread* t = i->second;
599:     // Start a new thread if there have not been any matches.
600:     // (No point in starting a new thread if there have been
620:       Thread* t = AllocThread();
85:   // Threadq is a list of threads.  The list is sorted by the order
98:   void AddToThreadq(Threadq* q, int id0, int c, int flag,
107:   // Frees all the threads on runq.
109:   inline int Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p);
123:   Threadq q0_, q1_;     // pre-allocated for Search.
151:   free_threads_ = NULL;
173:   free_threads_ = t->next;
191:   t->next = free_threads_;
192:   free_threads_ = t;
287:         t = AllocThread();
332: // Frees all the threads on runq.
334: int NFA::Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p) {
337:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
343:       // Can skip any threads started after our current best match.
402:           // Cut off the threads that can only find matches
404:           // rest of the current Threadq.
500:   Threadq* runq = &q0_;
501:   Threadq* nextq = &q1_;
547:       for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
627:     // If all the threads have died, stop early.
637:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i)
72:   // State for explicit stack in AddToThreadq.
126:   AddState* astack_;    // pre-allocated for AddToThreadq
144:   // See NFA::AddToThreadq() for why this is so.
254:       LOG(DFATAL) << "unhandled " << ip->opcode() << " in AddToThreadq";
360:         AddToThreadq(nextq, ip->out(), c, flag, p+1, t);
558:     // c and flag through to AddToThreadq() along with p-1+1, which is p.
623:       AddToThreadq(runq, start_, p < text.end() ? p[0] & 0xFF : -1, flag, p, t);
android.googlesource.com/platform/external/regex-re2:re2/nfa.cc:[master, ]
57:   struct Thread {
82:   typedef SparseArray<Thread*> Threadq;
157: void NFA::FreeThread(Thread *t) {
164: NFA::Thread* NFA::AllocThread() {
123:   Thread* free_threads_;  // free list
186: void NFA::AddToThreadq(Threadq* q, int id0, int flag,
60:       Thread* next;  // when on free list
84:   inline Thread* AllocThread();
85:   inline void FreeThread(Thread*);
149:   Thread* next;
150:   for (Thread* t = free_threads_; t; t = next) {
165:   Thread* t = free_threads_;
167:     t = new Thread;
220:     Thread** tp = &q->find(id)->second;
222:     Thread* t;
296:     Thread* t = i->second;
394: // Returns whether haystack contains needle's memory.
395: static bool StringPieceContains(const StringPiece haystack, const StringPiece needle) {
396:   return haystack.begin() <= needle.begin() &&
397:          haystack.end() >= needle.end();
504:         Thread* t = i->second;
561:     // Start a new thread if there have not been any matches.
562:     // (No point in starting a new thread if there have been
583:       // temporarily to hold match boundaries for new thread.
79:   // Threadq is a list of threads.  The list is sorted by the order
89:   void AddToThreadq(Threadq* q, int id, int flag,
98:   inline int Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p);
116:   Threadq q0_, q1_;     // pre-allocated for Search.
142:   free_threads_ = NULL;
160:   t->next = free_threads_;
161:   free_threads_ = t;
171:   free_threads_ = t->next;
234:       t = AllocThread();
266:       t = AllocThread();
290: // Frees all the threads on runq.
292: int NFA::Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p) {
295:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
301:       // Can skip any threads started after our current best match.
303:         FreeThread(t);
328:           FreeThread(t);
330:             FreeThread(i->second);
357:           // Cut off the threads that can only find matches
359:           // rest of the current Threadq.
361:           FreeThread(t);
363:             FreeThread(i->second);
372:     FreeThread(t);
460:   Threadq* runq = &q0_;
461:   Threadq* nextq = &q1_;
503:       for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
589:     // If all the threads have died, stop early.
605:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i)
606:     FreeThread(i->second);
65:   // State for explicit stack in AddToThreadq.
119:   AddState* astack_;    // pre-allocated for AddToThreadq
226:       LOG(DFATAL) << "unhandled " << ip->opcode() << " in AddToThreadq";
319:           AddToThreadq(nextq, ip->out(), flag, p+1, t->capture);
585:       AddToThreadq(runq, start_, flag, p, match_);
github.com/html5rocks/www.html5rocks.com:content/tutorials/doodles/lem/static/code/lem-const.js:[master, ]
185:   'needle': ['intro-finale/items-needle-thread', 'intro-finale/items-needle'],
220:   'thread': ['intro-finale/items-thread', 'intro-finale/items-thread'],
218:   'thread-thimble': ['intro-finale/items-thread-thimble',
219:                      'intro-finale/items-thread-thimble'],
236:     'needle', 'halo', 'noodles', 'neutron', 'nose'
239:     'thread', 'pinstripe', 'neutron', 'noodles', 'clove'
259:     'thread', 'thimble', 'earmuffs', 'neutron', 'nose'
265:     'thread', 'thimble', 'noodles', 'neutron', 'nose', 'gnocchi', 'rivet',
github.com/google/grumpy:lib/threading.py:[master, ]
54: class Thread(object):
55:   """Thread is an activity to be executed concurrently."""
17: from __go__.grumpy import StartThread
22:   """Event is a way to signal conditions between threads."""
66:     StartThread(self._run)
chromium.googlesource.com/external/github.com/ellzey/libevhtp:evhtp.h:[master, ]
462:     evthr_t * thread;
318:     evhtp_thread_init_cb thread_init_cb;
319:     void               * thread_init_cbarg;
163: typedef void (* evhtp_thread_init_cb)(evhtp_t * htp, evthr_t * thr, void * arg);
618:  * applications to add/remove/modify hooks & callbacks in a thread-safe manner.
707:  * @brief attempts to find the callback matching the exact string 'needle'. This is useful
727:  * @param needle
731: EVHTP_EXPORT evhtp_callback_t * evhtp_get_cb(evhtp_t * htp, const char * needle);
836:  * @brief Enable thread-pool support for an evhtp_t context. Connectios are
838:  *       be set which allows you to manipulate the thread-specific inforation
839:  *       (such as the thread-specific event_base).
848: EVHTP_EXPORT int evhtp_use_threads(evhtp_t * htp, evhtp_thread_init_cb init_cb, int nthreads, void * arg);
79: typedef pthread_mutex_t           evhtp_mutex_t;
313:     evthr_pool_t * thr_pool;            /**< connection threadpool */
317:     pthread_mutex_t    * lock;          /**< parent lock for add/del cbs in threads */
603: EVHTP_EXPORT int evhtp_ssl_use_threads(void);
617:  * @brief creates a lock around callbacks and hooks, allowing for threaded
837:  *       distributed across 'nthreads'. An optional "on-start" callback can
843:  * @param nthreads
android.googlesource.com/platform/external/avahi:avahi-common/thread-watch.c:[master, ]
62: static void* thread(void *userdata){
42:     pthread_t thread_id;
44:     int thread_running;
77: AvahiThreadedPoll *avahi_threaded_poll_new(void) {
107: void avahi_threaded_poll_free(AvahiThreadedPoll *p) {
123: const AvahiPoll* avahi_threaded_poll_get(AvahiThreadedPoll *p) {
129: int avahi_threaded_poll_start(AvahiThreadedPoll *p) {
142: int avahi_threaded_poll_stop(AvahiThreadedPoll *p) {
161: void avahi_threaded_poll_quit(AvahiThreadedPoll *p) {
170: void avahi_threaded_poll_lock(AvahiThreadedPoll *p) {
179: void avahi_threaded_poll_unlock(AvahiThreadedPoll *p) {
40: struct AvahiThreadedPoll {
38: #include "thread-watch.h"
53:      * avahi_simple_poll_quit() can succeed from another thread. */
66:     /* Make sure that signals are delivered to the main thread */
90:     p->thread_running = 0;
110:     /* Make sure that this function is not called from the helper thread */
111:     assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
113:     if (p->thread_running)
132:     assert(!p->thread_running);
134:     if (pthread_create(&p->thread_id, NULL, thread, p) < 0)
137:     p->thread_running = 1;
145:     if (!p->thread_running)
148:     /* Make sure that this function is not called from the helper thread */
149:     assert(!pthread_equal(pthread_self(), p->thread_id));
155:     pthread_join(p->thread_id, NULL);
156:     p->thread_running = 0;
164:     /* Make sure that this function is called from the helper thread */
165:     assert(pthread_equal(pthread_self(), p->thread_id));
173:     /* Make sure that this function is not called from the helper thread */
174:     assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
182:     /* Make sure that this function is not called from the helper thread */
183:     assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
31: #include <pthread.h>
43:     pthread_mutex_t mutex;
49:     pthread_mutex_t *mutex = userdata;
55:     pthread_mutex_unlock(mutex);
57:     pthread_mutex_lock(mutex);
68:     pthread_sigmask(SIG_BLOCK, &mask, NULL);
70:     pthread_mutex_lock(&p->mutex);
72:     pthread_mutex_unlock(&p->mutex);
86:     pthread_mutex_init(&p->mutex, NULL);
98:             pthread_mutex_destroy(&p->mutex);
114:         avahi_threaded_poll_stop(p);
119:     pthread_mutex_destroy(&p->mutex);
151:     pthread_mutex_lock(&p->mutex);
153:     pthread_mutex_unlock(&p->mutex);
176:     pthread_mutex_lock(&p->mutex);
185:     pthread_mutex_unlock(&p->mutex);
63:     AvahiThreadedPoll *p = userdata;
78:     AvahiThreadedPoll *p;
80:     if (!(p = avahi_new(AvahiThreadedPoll, 1)))
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:  * $Header: /home/jerenkrantz/tmp/commons/commons-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/google/j2objc:jre_emul/Classes/java/lang/Thread.java:[master, ]
52: public class Thread implements Runnable {
168:   private static final String THREAD = "Thread-";
188:   public Thread() {
202:   public Thread(Runnable runnable) {
217:   public Thread(Runnable runnable, String threadName) {
230:   public Thread(String threadName) {
250:   public Thread(ThreadGroup group, Runnable runnable) {
272:   public Thread(ThreadGroup group, Runnable runnable, String threadName, long stack) {
293:   public Thread(ThreadGroup group, Runnable runnable, String threadName) {
311:   public Thread(ThreadGroup group, String threadName) {
315:   private Thread(
56:   private final Object nativeThread;
58:   private final long threadId;
67:   ThreadLocal.ThreadLocalMap threadLocals = null;
74:   private ThreadGroup threadGroup;
88:   private static long threadOrdinalNum = 1;
177:   private static native Object newNativeThread() /*-[
367:   private static Thread createMainThread(Object nativeThread) {
384:   private static Thread createCurrentThread(Object nativeThread) {
388:   public static native Thread currentThread() /*-[
68:   ThreadLocal.ThreadLocalMap inheritableThreadLocals = null;
374:   private static native void initializeThreadClass() /*-[
527:   public ThreadGroup getThreadGroup() {
790:   private static synchronized long getNextThreadId() {
44:  * Simplified iOS version of java.lang.Thread, based on Apache Harmony source
45:  * (both luni-kernel and vmcore). This class uses pthread for thread creation
47:  * pthread's thread local mechanism (pthread_setspecific) is used to associate
48:  * this wrapper object with the current thread.
70:   /** The object the thread is waiting on (normally null). */
76:   /** the park state of the thread */
79:   /** The synchronization object responsible for this thread parking. */
86:    * Counter used to generate thread's ID
91:    * A representation of a thread's state. A given thread may only be in one
96:      * The thread has been created, but has never been started.
100:      * The thread may be run.
104:      * The thread is blocked and waiting for a lock.
108:      * The thread is waiting.
112:      * The thread is waiting for a specified amount of time.
116:      * The thread has been terminated.
135:     void uncaughtException(Thread t, Throwable e);
146:    * The maximum priority value allowed for a thread.
153:    * The minimum priority value allowed for a thread.
166:    * used to generate a default thread name
170:   // Milliseconds between polls for testing thread completion.
182:    * Constructs a new Thread with no runnable object and a newly generated
183:    * name. The new Thread will belong to the same ThreadGroup as the Thread
189:     this(null, null, THREAD, 0, null);
193:    * Constructs a new Thread with a runnable object and a newly generated
194:    * name. The new Thread will belong to the same ThreadGroup as the Thread
198:    *        be executed by the new Thread
203:     this(null, runnable, THREAD, 0, null);
207:    * Constructs a new Thread with a runnable object and name provided. The new
208:    * Thread will belong to the same ThreadGroup as the Thread calling this
212:    *        be executed by the new Thread
213:    * @param threadName Name for the Thread being created
222:    * Constructs a new Thread with no runnable object and the name provided.
223:    * The new Thread will belong to the same ThreadGroup as the Thread calling
226:    * @param threadName Name for the Thread being created
235:    * Constructs a new Thread with a runnable object and a newly generated
236:    * name. The new Thread will belong to the ThreadGroup passed as parameter.
238:    * @param group ThreadGroup to which the new Thread will belong
240:    *        be executed by the new Thread
251:     this(group, runnable, THREAD, 0, null);
255:    * Constructs a new Thread with a runnable object, the given name and
258:    * @param group ThreadGroup to which the new Thread will belong
260:    *        be executed by the new Thread
261:    * @param threadName Name for the Thread being created
277:    * Constructs a new Thread with a runnable object, the given name and
280:    * @param group ThreadGroup to which the new Thread will belong
282:    *        be executed by the new Thread
283:    * @param threadName Name for the Thread being created
298:    * Constructs a new Thread with no runnable object, the given name and
301:    * @param group ThreadGroup to which the new Thread will belong
302:    * @param threadName Name for the Thread being created
319:     if (name.equals(THREAD)) {
325:       // Thread is not yet started.
326:       Thread currentThread = currentThread();
333:       // Thread is already running.
342:   pthread_key_t java_thread_key;
345:     JavaLangThread *thread = (JavaLangThread *)javaThread;
346:     [thread exit];
347:     [thread release];
351:     JavaLangThread *thread = (JavaLangThread *)arg;
352:     pthread_setspecific(java_thread_key, thread);
355:         [thread run];
357:         [thread rethrowWithJavaLangThrowable:t];
359:         [thread rethrowWithJavaLangThrowable:create_JavaLangThrowable_initWithNSString_(
368:     return new Thread(ThreadGroup.mainThreadGroup, null, "main", 0, nativeThread);
372:    * Create a Thread wrapper around the main native thread.
375:     if (pthread_key_create(&java_thread_key, &javaThreadDestructor)) {
381:     pthread_setspecific(java_thread_key, [mainThread retain]);
385:     return new Thread(ThreadGroup.mainThreadGroup, null, THREAD, 0, nativeThread);
389:     JavaLangThread *thread = pthread_getspecific(java_thread_key);
390:     if (thread) {
391:       return thread;
395:     thread = JavaLangThread_createCurrentThreadWithId_(nt);
396:     pthread_setspecific(java_thread_key, [thread retain]);
397:     return thread;
402:       throw new IllegalThreadStateException("This thread was already started!");
464:    * stack for this Thread.
472:   public static int enumerate(Thread[] threads) {
473:     Thread thread = Thread.currentThread();
474:     return thread.getThreadGroup().enumerate(threads);
567:    * Posts an interrupt request to this {@code Thread}. Unless the caller is
571:    * the state of this {@code Thread}:
574:    * {@code Thread}s blocked in one of {@code Object}'s {@code wait()} methods
575:    * or one of {@code Thread}'s {@code join()} or {@code sleep()} methods will
579:    * {@code Thread}s blocked in an I/O operation of an
585:    * {@code Thread}s blocked in a {@link java.nio.channels.Selector} will have
594:    * @see Thread#interrupted
595:    * @see Thread#isInterrupted
617:    * Returns a <code>boolean</code> indicating whether the current Thread (
623:    * @see Thread#currentThread
624:    * @see Thread#interrupt
625:    * @see Thread#isInterrupted
628:     Thread currentThread = currentThread();
640:    * @see Thread#interrupt
641:    * @see Thread#interrupted
648:    * Blocks the current Thread (<code>Thread.currentThread()</code>) until
669:    * Blocks the current Thread (<code>Thread.currentThread()</code>) until
684:    * Blocks the current Thread (<code>Thread.currentThread()</code>) until
720:           // wait until this thread completes or the timeout has elapsed
770:           if (Thread.interrupted()) {
783:    * Causes the calling Thread to yield execution time to another Thread that
795:    * Indicates whether the current Thread has a monitor lock on the specified
799:    * @return true if the current thread has a monitor lock on the specified
807:    * Returns the context ClassLoader for this Thread.
823:       return "Thread[" + getName() + "," + getPriority() + "," + group.getName() + "]";
825:     return "Thread[" + getName() + "," + getPriority() + ",]";
829:    * Unparks this thread. This unblocks the thread it if it was
830:    * previously parked, or indicates that the thread is "preemptively
832:    * next time the thread is told to park, it will merely clear its
848:            * preemptively unparked thread is to remain in
868:    * Parks the current thread for a particular number of nanoseconds, or
869:    * indefinitely. If not indefinitely, this method unparks the thread
870:    * after the given number of nanoseconds if no other thread unparks it
871:    * first. If the thread has been "preemptively unparked," this method
873:    * also return spuriously (that is, without the thread being told to
880:    * thread.
926:    * Parks the current thread until the specified system time. This
927:    * method attempts to unpark the current thread immediately after
929:    * value, if no other thread unparks it first. If the thread has
932:    * spuriously (that is, without the thread being told to unpark
939:    * current thread.
941:    * @param time the time after which the thread should be unparked,
976:    * exception terminates a thread.
987:    * case any Thread dies due to an unhandled exception.
993:       Thread.defaultUncaughtHandler = handler;
997:    * Returns the handler invoked when this thread abruptly terminates
998:    * due to an uncaught exception. If this thread has not had an
999:    * uncaught exception handler explicitly set then this thread's
1000:    * <tt>ThreadGroup</tt> object is returned, unless this thread
1010:    * Set the handler invoked when this thread abruptly terminates
1012:    * <p>A thread can take full control of how it responds to uncaught
1014:    * If no such handler is set then the thread's <tt>ThreadGroup</tt>
1016:    * @param eh the object to use as this thread's uncaught exception
1017:    * handler. If <tt>null</tt> then this thread has no explicit handler.
1018:    * @throws  SecurityException  if the current thread is not allowed to
1019:    *          modify this thread.
1031:     public synchronized void uncaughtException(Thread t, Throwable e) {
1032:       System.err.print("Exception in thread \"" + t.getName() + "\" ");
1038:    * Adds a runnable to be invoked upon interruption. If this thread has
1080:   public static Map<Thread,StackTraceElement[]> getAllStackTraces() {
1081:     return Collections.<Thread, StackTraceElement[]>emptyMap();
30: #import <pthread.h>
34: @interface NativeThread : NSObject {
36:   pthread_t t;
39: @implementation NativeThread
46:  * and maintains a pthread handle for using other pthread functionality.
55:   /** Android source declares this as the native VMThread class. */
160:    * The normal (default) priority value assigned to threads.
178:     return [[[NativeThread alloc] init] autorelease];
186:    * @see java.lang.ThreadGroup
199:    * @see java.lang.ThreadGroup
214:    * @see java.lang.ThreadGroup
218:     this(null, runnable, threadName, 0, null);
227:    * @see java.lang.ThreadGroup
231:     this(null, null, threadName, 0, null);
245:    * @see java.lang.ThreadGroup
256:    * belonging to the ThreadGroup passed as parameter.
267:    * @see java.lang.ThreadGroup
273:     this(group, runnable, threadName, stack, null);
278:    * belonging to the ThreadGroup passed as parameter.
288:    * @see java.lang.ThreadGroup
294:     this(group, runnable, threadName, 0, null);
299:    * belonging to the ThreadGroup passed as parameter.
307:    * @see java.lang.ThreadGroup
312:     this(group, null, threadName, 0, null);
316:       ThreadGroup group, Runnable runnable, String name, long stack, Object nativeThread) {
318:     this.threadId = getNextThreadId();
320:       name += threadId;
324:     if (nativeThread == null) {
327:       nativeThread = newNativeThread();
328:       this.priority = currentThread.getPriority();
330:         group = currentThread.getThreadGroup();
337:     this.threadGroup = group;
338:     this.nativeThread = nativeThread;
344:   void javaThreadDestructor(void *javaThread) {
376:       @throw create_JavaLangAssertionError_initWithId_(@"Failed to create pthread key.");
378:     NativeThread *nt = [[[NativeThread alloc] init] autorelease];
379:     nt->t = pthread_self();
380:     JavaLangThread *mainThread = JavaLangThread_createMainThreadWithId_(nt);
393:     NativeThread *nt = [[[NativeThread alloc] init] autorelease];
394:     nt->t = pthread_self();
404:     threadGroup.add(this);
413:     NativeThread *nt = (NativeThread *)self->nativeThread_;
414:     pthread_attr_t attr;
415:     pthread_attr_init(&attr);
417:     if (stack >= PTHREAD_STACK_MIN) {
418:       pthread_attr_setstacksize(&attr, stack);
420:     pthread_create(&nt->t, &attr, &start_routine, [self retain]);
425:     if (threadGroup != null) {
426:       threadGroup.threadTerminated(this);
427:       threadGroup = null;
451:       return currentThread().getThreadGroup().activeCount();
478:     return threadId;
498:     ThreadGroup g;
518:     param.sched_priority = (priority * 64 / JavaLangThread_MAX_PRIORITY) - 1;
519:     NativeThread *nt = (NativeThread *)self->nativeThread_;
520:     pthread_setschedparam(nt->t, SCHED_OTHER, &param);
528:     return state == State.TERMINATED ? null : threadGroup;
568:    * the {@link #currentThread()}, the method {@code checkAccess()} is called
598:     synchronized(nativeThread) {
618:    * <code>currentThread()</code>) has a pending interrupt request (<code>
629:     boolean result = currentThread.interrupted;
630:     currentThread.interrupted = false;
654:    * @see java.lang.ThreadDeath
661:       synchronized (nativeThread) {
663:               nativeThread.wait(POLL_INTERVAL);
677:    * @see java.lang.ThreadDeath
693:    * @see java.lang.ThreadDeath
712:       synchronized (nativeThread) {
724:                 nativeThread.wait(POLL_INTERVAL);
726:                 nativeThread.wait(millis, nanos);
776:       Object lock = currentThread().nativeThread;
787:     pthread_yield_np();
791:     return threadOrdinalNum++;
821:     ThreadGroup group = getThreadGroup();
841:     Object vmt = nativeThread;
889:     Object vmt = nativeThread;
947:     Object vmt = nativeThread;
1006:     return h != null ? h : threadGroup;
1021:    * @see ThreadGroup#uncaughtException
1077:    * Returns a map of stack traces for all live threads.
1086:     stop(new ThreadDeath());
174:     initializeThreadClass();
243:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
265:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
286:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
305:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
503:     if ((g = getThreadGroup()) != null) {
android.googlesource.com/platform/external/nist-sip:java/gov/nist/core/ThreadAuditor.java:[master, ]
36:         private Thread thread;
23: public class ThreadAuditor {
25:     private Map<Thread,ThreadHandle> threadHandles = new HashMap<Thread,ThreadHandle>();
31:     public class ThreadHandle {
39:         private ThreadAuditor threadAuditor;
42:         public ThreadHandle(ThreadAuditor aThreadAuditor) {
59:         public Thread getThread() {
102:     public synchronized ThreadHandle addCurrentThread() {
113:     public synchronized void removeThread(Thread thread) {
33:         private boolean isThreadActive;
49:         public boolean isThreadActive() {
54:         protected void setThreadActive(boolean value) {
132:     public synchronized String auditThreads() {
6:  * Thread Auditor class:
15:  *     the thread can periodically ping the auditor.
32:         /// Set to true when the thread pings, periodically reset to false by the auditor
35:         /// Thread being monitored
38:         /// Thread auditor monitoring this thread
44:             thread = Thread.currentThread();
48:         /// Called by the auditor thread to check the ping status of the thread
53:         /// Called by the auditor thread to reset the ping status of the thread
58:         /// Return the thread being monitored
60:             return thread;
80:                     .append("Thread Name: ").append(thread.getName())
81:                     .append(", Alive: ").append(thread.isAlive());
86:     /// Indicates how often monitored threads are supposed to ping (0 = no thread monitoring)
101:     /// Called by a thread that wants to be monitored
103:         // Create and return a thread handle but only add it
107:             threadHandles.put(Thread.currentThread(), threadHandle);
112:     /// Stops monitoring a given thread
114:         threadHandles.remove(thread);
117:     /// Called by a monitored thread reporting that it's alive and well
141:                 // Get the non-responsive thread
142:                 Thread thread = threadHandle.getThread();
146:                     auditReport = "Thread Auditor Report:\n";
148:                 auditReport += "   Thread [" + thread.getName() + "] has failed to respond to an audit request.\n";
156:                 //      stackTraces = Thread.getAllStackTraces();
159:                 //  // Get the stack trace for the non-responsive thread
160:                 //  StackTraceElement[] stackTraceElements = (StackTraceElement[])stackTraces.get(thread);
173:             // Reset the ping status of the thread
185:         String toString = "Thread Auditor - List of monitored threads:\n";
7:  *   - Provides a mechanism for applications to check the health of internal threads
9:  *   - Threads register with the auditor at startup and "ping" the auditor every so often.
11:  *     auditor reports if the threads are healthy or if any of them failed to ping and are
13:  *   - The main implication for the monitored threads is that they can no longer block
24:     /// Threads being monitored
27:     /// How often are threads supposed to ping
30:     /// Internal class, used as a handle by the monitored threads
45:             threadAuditor = aThreadAuditor;
63:         // Helper function to allow threads to ping using this handle
65:             threadAuditor.ping(this);
68:         // Helper function to allow threads to get the ping interval directly from this handle
70:             return threadAuditor.getPingIntervalInMillisecs();
91:     /// Defines how often monitored threads are supposed to ping
96:     /// Indicates if the auditing of threads is enabled
104:         // to the list of monitored threads if the auditor is enabled
105:         ThreadHandle threadHandle = new ThreadHandle(this);
109:         return threadHandle;
118:     public synchronized void ping(ThreadHandle threadHandle) {
119:         threadHandle.setThreadActive(true);
124:         threadHandles.clear();
128:      * Audits the sanity of all threads
136:         // Scan all monitored threads looking for non-responsive ones
137:         Iterator<ThreadHandle> it = threadHandles.values().iterator();
139:             ThreadHandle threadHandle = (ThreadHandle) it.next();
140:             if (!threadHandle.isThreadActive()) {
154:                 //  // Get stack traces for all live threads (do this only once per audit)
174:             threadHandle.setThreadActive(false);
186:         Iterator<ThreadHandle> it = threadHandles.values().iterator();
188:             ThreadHandle threadHandle = (ThreadHandle)it.next();
189:             toString += "   " + threadHandle.toString() + "\n";
43:             isThreadActive = false;
50:             return isThreadActive;
55:             isThreadActive = value;
chromium.googlesource.com/external/msysgit/msysgit:lib/perl5/5.8.8/Thread.pm:[master, ]
1: package Thread;
31: Thread - manipulate threads in Perl (for old code only)
35: Perl has two thread models.
37: In Perl 5.005 the thread model was that all data is implicitly shared
41: In Perl 5.6 a new model was introduced in which all is was thread
58: For old code and interim backwards compatibility, the Thread module
67: For new code the use of the C<Thread> module is discouraged and
80:     use Thread;
82:     my $t = Thread->new(\&start_sub, @start_args);
92:     if($t->equal($another_thread)) {
98:     my $tid = Thread->self->tid; 
108:     my @list = Thread->list;	# not available with ithreads
110:     use Thread 'async';
114: The C<Thread> module provides multithreading support for perl.
120: =item $thread = Thread->new(\&start_sub)
122: =item $thread = Thread->new(\&start_sub, LIST)
124: C<new> starts a new thread of execution in the referenced subroutine. The
128: C<Thread-&gt;new> returns a thread object representing the newly created
129: thread.
135: If the variable is locked by another thread, the C<lock> call will
148: elements of that container are not locked. For example, if a thread
149: does a C<lock @a>, any other thread doing a C<lock($a[12])> won't
153: Any calls to that sub from another thread will block until the lock
158: thread access for the duration of the lock.
165: C<async> creates a thread to execute the block immediately following
167: semi-colon after the closing brace. Like C<Thread-&gt;new>, C<async>
168: returns a thread object.
170: =item Thread->self
172: The C<Thread-E<gt>self> function returns a thread object that represents
173: the thread making the C<Thread-E<gt>self> call.
178: a parameter, unlocks the variable, and blocks until another thread
190: unblocks one thread that's C<cond_wait>ing on that variable. If more than
191: one thread is blocked in a C<cond_wait> on that variable, only one (and
206: The C<yield> function allows another thread to take control of the
217: C<join> waits for a thread to end and returns any values the thread
218: exited with.  C<join> will block until the thread has ended, though
219: it won't block if the thread has already terminated.
221: If the thread being C<join>ed C<die>d, the error it died with will
222: be returned at this time. If you don't want the thread performing
224: an C<eval> or use the C<eval> thread method instead of C<join>.
229: a thread to exit, passing along any values the thread might have returned.
234: C<detach> tells a thread that it is never going to be joined i.e.
241: C<equal> tests whether two thread objects represent the same thread and
246: The C<tid> method returns the tid of a thread. The tid is
247: a monotonically increasing integer assigned when a thread is
248: created. The main thread of a program will have a tid of zero,
253: The C<flags> method returns the flags for the thread. This is the
254: integer value corresponding to the internal flags for the thread,
260: The C<done> method returns true if the thread you're checking has
277: L<attributes>, L<Thread::Queue>, L<Thread::Semaphore>,
278: L<Thread::Specific> (not available with ithreads)
291:     return Thread->new($_[0]);
307: 	*{"Thread::$m"} = sub { unimplemented $m };
320: 	    *{"Thread::$m"} = \&{"threads::$m"};
325: 	    *{"Thread::$m"} = \&{"threads::shared::${m}_enabled"};
330: 	XSLoader::load 'Thread';
11:     $othreads = $Config{use5005threads};
39: This model is called "5005threads".
43: This model is called "ithreads", for "interpreter threads".
49: In Perl 5.8 the ithreads model became available through the C<threads>
54: Perl's threading configuration by running C<perl -V> and looking for
55: the I<use...threads> variables, or inside script by C<use Config;>
56: and testing for C<$Config{use5005threads}> and C<$Config{useithreads}>.
59: has been reworked to function as a frontend for both 5005threads and
65: variables between the threads.
68: the direct use of the C<threads> and C<threads::shared> modules
72: 5005threads, one of the least of which is that regular expression
73: match variables like $1 are not threadsafe, that is, they easily get
74: corrupted by competing threads.  Other problems include more insidious
152: With 5005threads you may also C<lock> a sub, using C<lock &sub>.
156: access to a subroutine, but allows different threads non-simultaneous
181: after the C<cond_wait> is satisfied.  If there are multiple threads
194: If there are no threads blocked in a C<cond_wait> on the variable,
200: C<cond_broadcast>, though, will unblock B<all> the threads that are
236: Errors in detached threads will not be visible anywhere - if you want
249: while subsequent threads will have tids assigned starting with one.
269: program creates more than 2**32 - 1 threads in a single run, threads
275: L<threads::shared> (not available with 5005threads)
300:           $Config{useithreads} ? "ithreads" : "5005threads", "\n";
315: 	    Carp::croak("This Perl has both ithreads and 5005threads (serious malconfiguration)");
317: 	XSLoader::load 'threads';
322: 	require 'threads/shared.pm';
333: 	Carp::croak("This Perl has neither ithreads nor 5005threads");
5: our($VERSION, $ithreads, $othreads);
10:     $ithreads = $Config{useithreads};
21:     if ($ithreads) {
23:     } elsif ($othreads) {
45: In Perl 5.6 the ithreads model was not available as a public API,
53: above, in Win32 ithreads are always available.)  You can see your
60: ithreads.
64: be thought differently.  With the ithreads you must explicitly share()
76: use ithreads instead.
104:     lock(\&sub);	# not available with ithreads
106:     $flags = $t->flags;	# not available with ithreads
230: Errors, of course, get placed into C<$@>.  (Not available with ithreads.)
256: (Not available with ithreads.)
261: finished, and false otherwise.  (Not available with ithreads.)
312:     if ($ithreads) {
313: 	if ($othreads) {
329:     } elsif ($othreads) {
github.com/fuchsia-mirror/third_party-skia:dm/DM.cpp:[master, ]
124:     SkThreadID thread;
1265: SkThread* start_status_thread() {
1039: static SkTaskGroup gDefinitelyThreadSafeWork;
181:         if (task.thread == thisThread) {
1020: static bool match(const char* needle, const char* haystack) {
1021:     return 0 == strcmp("_", needle) || nullptr != strstr(haystack, needle);
1038: // .png encoding are definitely thread safe.  This lets us offload that work to CPU threads.
1266:     auto thread = new SkThread([] (void*) {
1276:     thread->start();
1277:     return thread;
1335:     std::unique_ptr<SkThread> statusThread(start_status_thread());
1362:     // With the parallel work running, run serial tasks and tests here on main thread.
62: DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
179:     SkThreadID thisThread = SkGetThreadID();
855:                                sk_ref_sp(gpuConfig->getColorSpace()), FLAGS_gpu_threading);
1037: // Even when a Task Sink reports to be non-threadsafe (e.g. GPU), we know things like
1080:             // We're likely switching threads here, so we must capture by value, [=] or [foo,bar].
1234:             (FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
1312:     SkTaskGroup::Enabler enabled(FLAGS_threads);
1375:     // At this point we're back in single-threaded land.
33: #include "SkThreadUtils.h"
161:     gRunning.push_back({id,SkGetThreadID()});
1082:             gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{
1368:     gDefinitelyThreadSafeWork.wait();
chromium.googlesource.com/skia:dm/DM.cpp:[master, ]
131:     SkThreadID thread;
1042: static SkTaskGroup gDefinitelyThreadSafeWork;
187:         if (task.thread == thisThread) {
1023: static bool match(const char* needle, const char* haystack) {
1024:     return 0 == strcmp("_", needle) || nullptr != strstr(haystack, needle);
1041: // .png encoding are definitely thread safe.  This lets us offload that work to CPU threads.
1355:     // With the parallel work running, run serial tasks and tests here on main thread.
65: DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
185:     SkThreadID thisThread = SkGetThreadID();
869:                                sk_ref_sp(gpuConfig->getColorSpace()), FLAGS_gpu_threading);
1040: // Even when a Task Sink reports to be non-threadsafe (e.g. GPU), we know things like
1083:             // We're likely switching threads here, so we must capture by value, [=] or [foo,bar].
1235:             (FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
1306:     SkTaskGroup::Enabler enabled(FLAGS_threads);
1368:     // At this point we're back in single-threaded land.
35: #include "SkThreadUtils.h"
180:     gRunning.push_back({id,SkGetThreadID()});
1085:             gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{
1361:     gDefinitelyThreadSafeWork.wait();
github.com/google/skia:dm/DM.cpp:[master, ]
duplicate result
github.com/google/perf_data_converter:third_party/chromiumos-wide-profiling/compat/ext/detail/thread.h:[master, ]
15: class Thread : public quipper::compat::ThreadInterface {
17:   explicit Thread(const string& name_prefix) {}
35:   std::thread thread_;
6: #define CHROMIUMOS_WIDE_PROFILING_COMPAT_EXT_DETAIL_THREAD_H_
5: #ifndef CHROMIUMOS_WIDE_PROFILING_COMPAT_EXT_DETAIL_THREAD_H_
11: #include <thread>
20:     thread_ = std::thread(&Thread::Run, this);
24:     thread_.join();
28:     return thread_.native_handle();
62: #endif  // CHROMIUMOS_WIDE_PROFILING_COMPAT_EXT_DETAIL_THREAD_H_
github.com/google/perf_data_converter:third_party/chromiumos-wide-profiling/compat/cros/detail/thread.h:[master, ]
13: class Thread : public quipper::compat::ThreadInterface,
16:   explicit Thread(const string& name_prefix) : thread_(this, name_prefix) {}
34:   base::DelegateSimpleThread thread_;
6: #define CHROMIUMOS_WIDE_PROFILING_COMPAT_CROS_DETAIL_THREAD_H_
5: #ifndef CHROMIUMOS_WIDE_PROFILING_COMPAT_CROS_DETAIL_THREAD_H_
9: #include "base/threading/simple_thread.h"
19:     thread_.Start();
23:     thread_.Join();
27:     return thread_.tid();
61: #endif  // CHROMIUMOS_WIDE_PROFILING_COMPAT_CROS_DETAIL_THREAD_H_
14:                public base::DelegateSimpleThread::Delegate {
github.com/google/swiftshader:src/Common/Thread.cpp:[master, ]
19: 	Thread::Thread(void (*threadFunction)(void *parameters), void *parameters)
33: 	Thread::~Thread()
15: #include "Thread.hpp"
38: 	void Thread::join()
54: 		unsigned long __stdcall Thread::startFunction(void *parameters)
62: 		void *Thread::startFunction(void *parameters)
22: 		Entry entry = {threadFunction, parameters, &init};
25: 			handle = CreateThread(NULL, 1024 * 1024, startFunction, &entry, 0, NULL);
27: 			pthread_create(&handle, NULL, startFunction, &entry);
35: 		join();   // Make threads exit before deleting them to not block here
46: 				pthread_join(handle, NULL);
58: 			entry.threadFunction(entry.threadParameters);
66: 			entry.threadFunction(entry.threadParameters);
76: 			pthread_cond_init(&handle, NULL);
77: 			pthread_mutex_init(&mutex, NULL);
87: 			pthread_cond_destroy(&handle);
88: 			pthread_mutex_destroy(&mutex);
android.googlesource.com/platform/external/swiftshader:src/Common/Thread.cpp:[master, ]
19: 	Thread::Thread(void (*threadFunction)(void *parameters), void *parameters)
33: 	Thread::~Thread()
15: #include "Thread.hpp"
38: 	void Thread::join()
48: 		unsigned long __stdcall Thread::startFunction(void *parameters)
56: 		void *Thread::startFunction(void *parameters)
22: 		Entry entry = {threadFunction, parameters, &init};
25: 			handle = CreateThread(0, 1024 * 1024, startFunction, &entry, 0, 0);
27: 			pthread_create(&handle, 0, startFunction, &entry);
35: 		join();   // Make threads exit before deleting them to not block here
43: 			pthread_join(handle, 0);
52: 			entry.threadFunction(entry.threadParameters);
60: 			entry.threadFunction(entry.threadParameters);
70: 			pthread_cond_init(&handle, 0);
71: 			pthread_mutex_init(&mutex, 0);
81: 			pthread_cond_destroy(&handle);
82: 			pthread_mutex_destroy(&mutex);
gerrit.googlesource.com/prolog-cafe:src/repl/BlockingPrologControl.java:[master, ]
108:   private volatile Thread thread;
9:  * Prolog thread.<br>
68:  *      Thread.sleep(10);
89:  *          Thread.sleep(100);
107:   /** A volatile instance variable holding a thread. */
128:    * allocates a new <code>Thread</code> object, and start the execution of the given goal.
129:    * And then it stops the thread and returns <code>true</code>
144:    * allocates a new <code>Thread</code> object, and start the execution of the given goal.
145:    * And then it stops the thread and returns <code>true</code>
151:   thread = new Thread(this);
152:   thread.setName("Prolog-" + p.toString());
153:   thread.start(); // execute run() in new thread.
155:       wait();     // wait caller's thread.
166:    * initilizes the Prolog engine, allocates a new <code>Thread</code> object,
201:    * Finally, while the <code>thread</code> is not <code>null</code> and
203:    * it waits until another thread invokes the <code>notify()</code> method
207:    * @see #thread
214:   while (thread != null && resultReady) {
229:    * Finally, while the <code>thread</code> is not <code>null</code> and
231:    * it waits until another thread invokes the <code>notify()</code> method
235:    * @see #thread
242:   while (thread != null && resultReady) {
252:     return thread == null;
255:   /** Waits for this thread to die. */
257:   while (thread != null && ! resultReady) {
266:    * Forces the thread to stop.<br>
268:    * This method first sets the <code>resultReady</code> and <code>thread</code>
272:    * @see #thread
276:   thread = null;
281:    * Forces the thread to start the execution.<br>
284:    * allocates a new <code>Thread</code> object, and start the execution.
285:    * The Java Virtual Machine calls the <code>run</code> method of this thread.
290:   thread = new Thread(this);
291:   thread.start();
295:    * Forces the thread to continue the execution.<br>
340:    * This method first waits until another thread invokes the <code>notify()</code>
342:    * while the <code>thread</code> is not <code>null</code> and
348:    * @see #thread
351:   while (thread != null && ! resultReady) {
183:    * and wakes up all threads that are waiting on this object's monitor.
200:    * And then it wakes up all threads that are waiting by <code>notifyAll()</code>.
228:    * And then it wakes up all threads that are waiting by <code>notifyAll()</code>.
270:    * And then it wakes up all threads that are waiting by <code>notifyAll()</code>.
298:    * and then wakes up all threads that are waiting by <code>notifyAll()</code>.
chromium.googlesource.com/infra/third_party/coverage:tests/test_concurrency.py:[master, ]
82:         THREAD = """\
87:         THREAD = """\
165:     def test_threads(self):
168:     def test_threads_simple_code(self):
46:         class Producer(threading.Thread):
48:                 threading.Thread.__init__(self)
56:         class Consumer(threading.Thread):
58:                 threading.Thread.__init__(self)
101:         monkey.patch_thread()
138:         elif C_TRACER or concurrency == "thread":
166:         self.try_some_code(self.THREAD, "thread", threading)
169:         self.try_some_code(self.SIMPLE, "thread", threading)
3: import os, os.path, sys, threading
80:     # Import the things to use threads.
83:         import threading
88:         import threading
94:         import eventlet.green.threading as threading
102:         import threading
140:             # can support all the concurrency, or if we are using threads.
161:                 "only threads are supported\n" % concurrency
github.com/google/mtail:vm/vm.go:[master, ]
133: type thread struct {
144: // expressions), mutable state (metrics), and a stack for the current thread of
156: 	t *thread // Current thread of execution
166: func (t *thread) Push(value interface{}) {
171: func (t *thread) Pop() (value interface{}) {
193: 	glog.Infof("Thread:")
213: func (t *thread) PopInt() (int64, error) {
234: func (t *thread) PopFloat() (float64, error) {
254: // instruction, and returns a boolean indicating if the current thread should
256: func (v *VM) execute(t *thread, i instr) {
569: 	t := new(thread)
chromium.googlesource.com/external/github.com/nedbat/coveragepy:tests/test_concurrency.py:[master, ]
140:     THREAD = """
145:     THREAD = """
245:     def test_threads(self):
249:     def test_threads_simple_code(self):
93:     class Producer(threading.Thread):
95:             threading.Thread.__init__(self)
104:     class Consumer(threading.Thread):
106:             threading.Thread.__init__(self)
159:     monkey.patch_thread()
189:     elif env.C_TRACER or concurrency == "thread" or concurrency == "":
246:         code = (THREAD + SUM_RANGE_Q + PRINT_SUM_RANGE).format(QLIMIT=self.QLIMIT)
247:         self.try_some_code(code, "thread", threading)
251:         self.try_some_code(code, "thread", threading)
6: import threading
91:     # Above this will be imports defining queue and threading.
138: # Import the things to use threads.
141:     import threading
146:     import threading
152:     import eventlet.green.threading as threading
160:     import threading
194:             "only threads are supported\n" % concurrency
225:             # can support all the concurrency, or if we are using threads.
407:         self.try_multiprocessing_code(code, expected_out, threading)
github.com/fuchsia-mirror/traceviz:src/traceviz.h:[master, ]
116: struct Thread : public Object {
106:     virtual Thread* as_thread() { return nullptr; }
120:     virtual Thread* as_thread() { return this; }
90: #define KTHREAD  2 // extra = pid
160:     Thread* kthread_list;
94: struct Thread;
119:     Thread(uint32_t id);
170:     Thread* active[MAXCPU];
179:     void evt_thread_name(uint32_t tid, uint32_t pid, const char* name);
184:     void evt_process_create(uint64_t ts, Thread* t, uint32_t pid);
185:     void evt_process_delete(uint64_t ts, Thread* t, uint32_t pid);
186:     void evt_process_start(uint64_t ts, Thread* t, uint32_t pid, uint32_t tid);
187:     void evt_thread_create(uint64_t ts, Thread* t, uint32_t tid, uint32_t pid);
188:     void evt_thread_delete(uint64_t ts, Thread* t, uint32_t tid);
189:     void evt_thread_start(uint64_t ts, Thread* t, uint32_t tid);
190:     void evt_msgpipe_create(uint64_t ts, Thread* t, uint32_t id, uint32_t otherid);
191:     void evt_msgpipe_delete(uint64_t ts, Thread* t, uint32_t id);
192:     void evt_msgpipe_write(uint64_t ts, Thread* t, uint32_t id, uint32_t bytes, uint32_t handles);
193:     void evt_msgpipe_read(uint64_t ts, Thread* t, uint32_t id, uint32_t bytes, uint32_t handles);
194:     void evt_port_create(uint64_t ts, Thread* t, uint32_t id);
195:     void evt_port_wait(uint64_t ts, Thread* t, uint32_t id);
196:     void evt_port_wait_done(uint64_t ts, Thread* t, uint32_t id);
197:     void evt_port_delete(uint64_t ts, Thread* t, uint32_t id);
198:     void evt_wait_one(uint64_t ts, Thread* t, uint32_t id, uint32_t signals, uint64_t timeout);
199:     void evt_wait_one_done(uint64_t ts, Thread* t, uint32_t id, uint32_t pending, uint32_t status);
205:     void evt_probe(uint64_t ts, Thread* t, uint32_t evt, uint32_t arg0, uint32_t arg1);
212:     Thread* find_thread(uint32_t id, bool create = true);
215:     Thread* find_kthread(uint32_t id, bool create = true);
180:     void evt_kthread_name(uint32_t tid, const char* name);
183:                             uint32_t oldthread, uint32_t newthread);
github.com/google/gtm-oauth2:Source/GTMOAuth2Authentication.m:[master, ]
104: @property (atomic, retain) NSThread *thread;
96:   NSThread *thread_;
111:                                          thread:(NSThread *)thread;
120:             thread = thread_,
127:                                          thread:(NSThread *)thread {
134:   obj.thread = thread;
142:   [thread_ release];
356:                                               thread:[NSThread currentThread]];
380:                                               thread:[NSThread currentThread]];
572:   // Invoke any callbacks on the proper thread
574:     NSThread *targetThread = args.thread;
580:       // (or if it's nil, we'll use the main thread) for callbacks.
597:         // if that's available, else we'll hope the original thread has a spinning run loop.
656:                                               thread:[NSThread currentThread]];
575:     BOOL isSameThread = [targetThread isEqual:[NSThread currentThread]];
576:     if (isSameThread) {
608:                        onThread:targetThread
github.com/google/arithmancer:third_party/werkzeug/serving.py:[master, ]
50:     import _thread as thread
401:     multithread = False
453: class ThreadedWSGIServer(ThreadingMixIn, BaseWSGIServer):
455:     multithread = True
48:     import thread
508:     """When this function is run from the main thread, it will force other
585:     but running the reloader thread.
611:         thread.start_new_thread(main_func, ())
661:                      thread?
53:     from SocketServer import ThreadingMixIn, ForkingMixIn
56:     from socketserver import ThreadingMixIn, ForkingMixIn
88:             'wsgi.multithread':     self.server.multithread,
400:     """Simple single-threaded, single-process WSGI server."""
454:     """A WSGI server that does threading."""
469: def make_server(host, port, app=None, threaded=False, processes=1,
472:     """Create a new server instance that is either threaded, or forks
475:     if threaded and processes > 1:
478:     elif threaded:
479:         return ThreadedWSGIServer(host, port, app, request_handler,
509:     threads to exit when any modules currently loaded change.
624:                extra_files=None, reloader_interval=1, threaded=False,
660:     :param threaded: should the process handle each request in a separate
690:         make_server(hostname, port, application, threaded,
476:         raise ValueError("cannot have a multithreaded and "
628:     wraps `wsgiref` to fix the wrong default reporting of the multithreaded
629:     WSGI variable and adds optional multithreading and fork support.
github.com/foam-framework/foam:lib/gmail/SchemaImport.js:[master, ]
503:   "Thread": {
323:     "threads": {
380:     "threadId": {
1463:     "threads": {
309:   "ListThreadsResponse": {
482:   "ModifyThreadRequest": {
214:      "description": "The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the INBOX and UNREAD labels from messages and threads, but cannot apply or remove the DRAFTS or SENT labels from messages or threads.",
327:       "$ref": "Thread"
382:      "description": "The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: \n- The requested threadId must be specified on the Message or Draft.Message you supply with your request. \n- The References and In-Reply-To headers must be set in compliance with the \u003ca href=\"https://tools.ietf.org/html/rfc2822\"RFC 2822 standard. \n- The Subject headers must match."
489:      "description": "A list of IDs of labels to add to this thread.",
496:      "description": "A list of IDs of labels to remove from this thread.",
504:    "id": "Thread",
507:    "externalTypeName": "caribou.api.proto.Thread",
511:      "description": "The ID of the last history record that modified this thread.",
516:      "description": "The unique ID of the thread."
520:      "description": "The list of messages in the thread.",
830:          "description": "Required. Returns history records after the specified startHistoryId. The supplied startHistoryId should be obtained from the historyId of a message, thread, or previous list response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date startHistoryId typically returns an HTTP 404 error code. A historyId is typically valid for at least a week, but in some circumstances may be valid for only a few hours. If you receive an HTTP 404 error response, your application should perform a full sync. If you receive no nextPageToken in the response, there are no updates to retrieve and you can store the returned historyId for a future request.",
1469:        "description": "Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead.",
1473:          "description": "ID of the Thread to delete.",
1497:        "description": "Gets the specified thread.",
1501:          "description": "The ID of the thread to retrieve.",
1518:         "$ref": "Thread"
1585:        "description": "Modifies the labels applied to the thread. This applies to all messages in the thread.",
1589:          "description": "The ID of the thread to modify.",
1609:         "$ref": "Thread"
1620:        "description": "Moves the specified thread to the trash.",
1624:          "description": "The ID of the thread to Trash.",
1641:         "$ref": "Thread"
1652:        "description": "Removes the specified thread from the trash.",
1656:          "description": "The ID of the thread to remove from Trash.",
1673:         "$ref": "Thread"
1738:    GMailSchema.schemas.Thread
152:    "description": "Labels are used to categorize messages and threads within the user's mailbox.",
325:      "description": "List of threads.",
890:        "description": "Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.",
1466:        "id": "gmail.users.threads.delete",
1467:        "path": "{userId}/threads/{id}",
1494:        "id": "gmail.users.threads.get",
1495:        "path": "{userId}/threads/{id}",
1527:        "id": "gmail.users.threads.list",
1528:        "path": "{userId}/threads",
1530:        "description": "Lists the threads in the user's mailbox.",
1534:          "description": "Include threads from SPAM and TRASH in the results.",
1540:          "description": "Only return threads with labels that match all of the specified label IDs.",
1546:          "description": "Maximum number of threads to return.",
1558:          "description": "Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\".",
1582:        "id": "gmail.users.threads.modify",
1583:        "path": "{userId}/threads/{id}/modify",
1617:        "id": "gmail.users.threads.trash",
1618:        "path": "{userId}/threads/{id}/trash",
1649:        "id": "gmail.users.threads.untrash",
1650:        "path": "{userId}/threads/{id}/untrash",
1746:   'threads'
310:    "id": "ListThreadsResponse",
312:    "externalTypeName": "caribou.api.proto.ListThreadsResponse",
483:    "id": "ModifyThreadRequest",
485:    "externalTypeName": "caribou.api.proto.ModifyThreadRequest",
1573:         "$ref": "ListThreadsResponse"
1606:         "$ref": "ModifyThreadRequest"
android.googlesource.com/platform/build/soong:ui/build/context.go:[master, ]
67: 	Thread tracer.Thread
74: 		c.Tracer.Begin(name, c.Thread)
81: 		c.Tracer.End(c.Thread)
88: 		c.Tracer.Complete(name, c.Thread, begin, end)
95: 		c.Tracer.ImportNinjaLog(c.Thread, filename, startOffset)
github.com/googlearchive/appengine-try-python-flask:lib/werkzeug/serving.py:[master, ]
duplicate result
github.com/GoogleCloudPlatform/deepbreath:third_party/gmail.js:[master, ]
2597:   api.dom.thread = function(element) {
155:   api.check.is_thread = function() {
1195:       'view_thread': {
732:                       'toggle_threads'  : 'toggle_threads'
704:                       'dm'          : 'delete_message_in_thread',
730:                       'rtr'         : 'restore_message_in_thread',
1190:     api.tracker.supported_observers = ['view_thread', 'view_email', 'load_email_menu', 'recipient_change', 'compose'];
1193:       // when a thread is clicked on in a mailbox for viewing - note: this should fire at a similar time (directly after) as the open_email XHR observer
1199:           match = new api.dom.thread(match);
1202:           // look for any email elements in this thread that are currently displaying
1206:             api.observe.trigger_dom('view_email', email, api.tracker.dom_observers.view_thread.sub_observers.view_email.handler);
1211:           // when an individual email is loaded within a thread (also fires when thread loads displaying the latest email)
1804:         data.thread_id = x[1];
2434:     An object for interacting with an email currently present in the DOM. Represents an individual email message within a thread
2550:         // retrieve & cache the data for this whole thread of emails
2593:     An object for interacting with an email currently present in the DOM. Represents a conversation thread
2595:     Expects a jQuery DOM element for the thread wrapper div (div.if as returned by the 'view_thread' observer)
2598:     if (!element || (!element.hasClass('if'))) api.tools.error('api.dom.thread called with invalid element/id');
2603:   $.extend(api.dom.thread.prototype, {
337:       return Object.keys(data.threads);
817:       if(api.observe.bound('toggle_threads')) {
818:         triggered.toggle_threads = response;
825:         if(api.observe.bound('toggle_threads')) {
826:           triggered.toggle_threads = response;
1799:     var threads = {};
1808:         data.total_threads = x[8];
1814:         if(data.threads == undefined) {
1815:           data.threads = {};
1818:         data.threads[x[1]] = {};
1819:         data.threads[x[1]].is_deleted = x[13] == undefined;
1820:         data.threads[x[1]].reply_to_id = x[2];
1821:         data.threads[x[1]].from = x[5];
1822:         data.threads[x[1]].from_email = x[6];
1823:         data.threads[x[1]].timestamp = x[7];
1824:         data.threads[x[1]].datetime = x[24];
1825:         data.threads[x[1]].attachments = x[21].split(',');
1826:         data.threads[x[1]].subject = x[12];
1827:         data.threads[x[1]].content_html = (x[13] != undefined) ? x[13][6] : x[8];
1828:         data.threads[x[1]].to = (x[13] != undefined) ? x[13][1] : ((x[37] != undefined) ? x[37][1]:[]);
1829:         data.threads[x[1]].cc = (x[13] != undefined) ? x[13][2] : [];
1830:         data.threads[x[1]].bcc = (x[13] != undefined) ? x[13][3] : [];
1831:         data.threads[x[1]].reply_to = api.tools.get_reply_to(x[13]);
1834:           data.threads[x[1]].content_plain = (x[13] != undefined) ? $(x[13][6]).text() : x[8];
1837:           data.threads[x[1]].content_plain = (x[13] != undefined) ? x[13][6] : x[8];
1958:       var threads = displayed_email_data.threads;
1959:       var total_threads = displayed_email_data.total_threads;
1964:       for (var id in threads) {
1965:         var email = threads[id];
1969:           delete threads[id];
1970:           total_threads.splice(total_threads.indexOf(id), 1);
1977:       for (id in email_data.threads) {
1982:           var email = email_data.threads[id];
1988:           displayed_email_data.threads = {};
1989:           displayed_email_data.threads[id] = email;
1991:           displayed_email_data.total_threads = [id];
2552:         $.each(data.threads, function(email_id, email_data) {
github.com/GoogleChrome/chrome-app-samples:samples/text-editor/lib/ace/mode/text.js:[master, ]
135:             needle: needle
117:         var needle = line.substring(Math.max(startOuter, 0),
121:         if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
122:             (endOuter <= lineCols && /[\w\d]$/.test(needle)))
125:         needle = line.substring(selection.start.column, selection.end.column);
126:         if (!/^[\w\d]+$/.test(needle))
chromium.googlesource.com/chromium/deps/psyco_win32:psyco/profiler.py:[master, ]
20:     import dummy_thread as thread
365: def psyco_start_new_thread(callable, args, kw=None):
371: original_start_new_thread = thread.start_new_thread
358: def psyco_thread_stub(callable, args, kw):
18:     import thread
32: # a lock for a thread-safe go()
33: go_lock = thread.allocate_lock()
260:         self.lock = thread.allocate_lock()
343: # and thread.start_new_thread().
366:     "This is the Psyco-aware version of thread.start_new_thread()."
367:     return original_start_new_thread(psyco_thread_stub, (callable, args, kw))
374: thread.start_new_thread = psyco_start_new_thread
375: # hack to patch threading._start_new_thread if the module is
378:     hasattr(sys.modules['threading'], '_start_new_thread')):
379:     sys.modules['threading']._start_new_thread = psyco_start_new_thread
204:             alarm.stop(1)   # wait for parallel threads to stop
377: if ('threading' in sys.modules and
go.googlesource.com/debug:macho/macho.go:[master, ]
226: type Thread struct {
74: 	LoadCmdThread     LoadCmd = 4
75: 	LoadCmdUnixThread LoadCmd = 5 // thread+stack
225: // A Thread is a Mach-O thread state command.
84: 	{uint32(LoadCmdThread), "LoadCmdThread"},
85: 	{uint32(LoadCmdUnixThread), "LoadCmdUnixThread"},
chromium.googlesource.com/chromiumos/third_party/modemmanager-next:plugins/tests/test-port-context.c:[master, ]
26:     GThread *thread;
342: port_context_thread_func (TestPortContext *self)
310:     /* Signal that the thread is ready */
329:     g_assert (self->thread != NULL);
333:     /* Cancel main loop of the port context thread, by scheduling an idle task
334:      * in the thread-owned main context */
337:     g_thread_join (self->thread);
338:     self->thread = NULL;
347:     /* Define main context and loop for the thread */
350:     g_main_context_push_thread_default (self->context);
352:     /* Once the thread default context is setup, launch service */
367:     g_assert (self->thread == NULL);
368:     self->thread = g_thread_new (self->name,
369:                                  (GThreadFunc)port_context_thread_func,
372:     /* Now wait until the thread has finished its initialization and is
385:     g_assert (self->thread == NULL);
github.com/googlearchive/cloud-playground:lib/werkzeug/serving.py:[master, ]
duplicate result
github.com/fuchsia-mirror/magenta-rs:src/lib.rs:[master, ]
25: mod thread;
237:     Thread = 2,
519:     fn thread_time_increases() {
37: pub use thread::Thread;
194:         // Task signals (process, thread, job)
235:     /// The number of nanoseconds the current thread has been running for. Corresponds to
236:     /// MX_CLOCK_THREAD.
520:         let time1 = time_get(ClockId::Thread);
522:         let time2 = time_get(ClockId::Thread);
github.com/fuchsia-mirror/traceviz:src/ktrace.cpp:[master, ]
112: Thread::Thread(uint32_t _id) : Object(_id, KTHREAD) {
145: Thread* Trace::find_thread(uint32_t id, bool create) {
465:     uint32_t thread_new;
466:     uint32_t thread_del;
186: Thread* Trace::find_kthread(uint32_t id, bool create) {
285: void Trace::evt_thread_create(uint64_t ts, Thread* ct, uint32_t tid, uint32_t pid) {
295: void Trace::evt_thread_delete(uint64_t ts, Thread* t, uint32_t tid) {
297: void Trace::evt_thread_start(uint64_t ts, Thread* t, uint32_t tid) {
299: void Trace::evt_thread_name(uint32_t tid, uint32_t pid, const char* name) {
314: void Trace::evt_kthread_name(uint32_t tid, const char* name) {
115: void Thread::finish(uint64_t ts) {
148:         return o->as_thread();
151:         Thread* t = new Thread(id);
190:             return o->as_thread();
198:     // create new kernel thread
199:     Thread* t = new Thread(id);
238:     Thread* t;
240:         t = find_thread(oldtid);
247:         t = find_thread(newtid);
267: void Trace::evt_process_create(uint64_t ts, Thread* t, uint32_t pid) {
276: void Trace::evt_process_delete(uint64_t ts, Thread* t, uint32_t pid) {
278: void Trace::evt_process_start(uint64_t ts, Thread* t, uint32_t pid, uint32_t tid) {
286:     Thread* t = find_thread(tid);
288:         fprintf(stderr, "error: thread %08x already created\n", tid);
302:     Thread* t = find_thread(tid);
305:     // if thread is not created, it must be already running
315:     Thread* t = find_kthread(tid);
319: void Trace::evt_msgpipe_create(uint64_t ts, Thread* t, uint32_t id, uint32_t otherid) {
339: void Trace::evt_msgpipe_delete(uint64_t ts, Thread* t, uint32_t id) {
341: void Trace::evt_msgpipe_write(uint64_t ts, Thread* t, uint32_t id, uint32_t bytes, uint32_t handles) {
360: void Trace::evt_msgpipe_read(uint64_t ts, Thread* t, uint32_t id, uint32_t bytes, uint32_t handles) {
376: void Trace::evt_port_create(uint64_t ts, Thread* t, uint32_t id) {
378: void Trace::evt_port_wait(uint64_t ts, Thread* t, uint32_t id) {
381: void Trace::evt_port_wait_done(uint64_t ts, Thread* t, uint32_t id) {
384: void Trace::evt_port_delete(uint64_t ts, Thread* t, uint32_t id) {
387: void Trace::evt_wait_one(uint64_t ts, Thread* t, uint32_t id, uint32_t signals, uint64_t timeout) {
390: void Trace::evt_wait_one_done(uint64_t ts, Thread* t, uint32_t id, uint32_t pending, uint32_t status) {
398:     Thread* t = active[cpu];
410:     Thread* t = active[cpu];
419:     Thread* t = active[cpu];
432:     Thread* t = active[cpu];
443:     Thread* t = active[cpu];
450: void Trace::evt_probe(uint64_t ts, Thread* t, uint32_t evt, uint32_t arg0, uint32_t arg1) {
482:     fprintf(stderr, "thread created:   %u\n", s->thread_new);
528:     case EVT_THREAD_NAME:
531:         evt_thread_name(rec.name.id, rec.name.arg, recname(rec.name));
590:     Thread* t = find_thread(rec.hdr.tid);
606:                 s.thread_del++;
607:                 evt_thread_delete(ts, t, rec.x4.a);
628:     case EVT_THREAD_CREATE:
629:         s.thread_new++;
631:         evt_thread_create(ts, t, rec.x4.a, rec.x4.b);
633:     case EVT_THREAD_START:
635:         evt_thread_start(ts, t, rec.x4.a);
752:     // shuffle the idle threads to the front of the kernel thread list
88:     case KTHREAD: return "THRD";
146:     Object* o = find_object(id, KTHREAD);
178:     for (Object* obj = kthread_list; obj != nullptr; obj = obj->next) {
183: // kthread ids are their kvaddrs and may collide with koids
188:     for (o = kthread_list; o != nullptr; o = o->next) {
201:     t->next = kthread_list;
202:     kthread_list = t;
237:                                uint32_t oldthread, uint32_t newthread) {
242:         t = find_kthread(oldthread);
249:         t = find_kthread(newthread);
533:     case EVT_KTHREAD_NAME:
536:         evt_kthread_name(rec.name.id, recname(rec.name));
587:         // ignore kernel threads except for context switches
605:             case KTHREAD:
github.com/googlearchive/solutions-mobile-shopping-assistant-ios-client:GTLSource/GTMHTTPFetcher.h:[master, ]
545: @property (retain) NSThread *thread;
463:   NSThread *thread_;
82: // Callbacks require either that the thread used to start the fetcher have a run
83: // loop spinning (typically the main thread), or that an NSOperationQueue be
86: // callbacks on a background thread:
90: // or specify the main queue for callbacks on the main thread:
543: // The thread used to run this fetcher in the fetcher service when no operation
80: // Threading and queue support:
github.com/chromium/vim-codesearch:third_party/codesearch-py/codesearch/messages.py:[master, ]
389:   THREAD = 6600
592:       '_thread_local': bool,
github.com/GoogleChrome/chrome-app-samples:samples/text-editor/lib/ace/editor_highlight_selected_word_test.js:[master, ]
139:             needle: "Mauris"
194:             needle: "consectetur"
github.com/google/haskell-indexer:third_party/kythe/third_party/leveldb/db/db_bench.cc:[master, ]
535:     ThreadState* thread;
288: struct ThreadState {
294:   ThreadState(int index)
532:   struct ThreadArg {
539:   static void ThreadBody(void* v) {
70: static int FLAGS_threads = 1;
196:     // Just keep the messages from one thread
246:       // Rate is computed on actual elapsed time, not the sum of per-thread
274:   // Each thread goes through the following states:
287: // Per-thread state for concurrent executions of the same benchmark.
488:         num_threads++;  // Add extra thread for writing
542:     ThreadState* thread = arg->thread;
554:     thread->stats.Start();
555:     (arg->bm->*(arg->method))(thread);
556:     thread->stats.Stop();
580:       arg[i].thread = new ThreadState(i);
581:       arg[i].thread->shared = &shared;
598:       arg[0].thread->stats.Merge(arg[i].thread->stats);
600:     arg[0].thread->stats.Report(name);
603:       delete arg[i].thread;
608:   void Crc32c(ThreadState* thread) {
617:       thread->stats.FinishedSingleOp();
623:     thread->stats.AddBytes(bytes);
624:     thread->stats.AddMessage(label);
627:   void AcquireLoad(ThreadState* thread) {
632:     thread->stats.AddMessage("(each op is 1000 loads)");
638:       thread->stats.FinishedSingleOp();
643:   void SnappyCompress(ThreadState* thread) {
654:       thread->stats.FinishedSingleOp();
658:       thread->stats.AddMessage("(snappy failure)");
663:       thread->stats.AddMessage(buf);
664:       thread->stats.AddBytes(bytes);
668:   void SnappyUncompress(ThreadState* thread) {
679:       thread->stats.FinishedSingleOp();
684:       thread->stats.AddMessage("(snappy failure)");
686:       thread->stats.AddBytes(bytes);
705:   void WriteSeq(ThreadState* thread) {
706:     DoWrite(thread, true);
709:   void WriteRandom(ThreadState* thread) {
710:     DoWrite(thread, false);
713:   void DoWrite(ThreadState* thread, bool seq) {
717:       thread->stats.AddMessage(msg);
727:         const int k = seq ? i+j : (thread->rand.Next() % FLAGS_num);
732:         thread->stats.FinishedSingleOp();
740:     thread->stats.AddBytes(bytes);
743:   void ReadSequential(ThreadState* thread) {
749:       thread->stats.FinishedSingleOp();
753:     thread->stats.AddBytes(bytes);
756:   void ReadReverse(ThreadState* thread) {
762:       thread->stats.FinishedSingleOp();
766:     thread->stats.AddBytes(bytes);
769:   void ReadRandom(ThreadState* thread) {
775:       const int k = thread->rand.Next() % FLAGS_num;
780:       thread->stats.FinishedSingleOp();
784:     thread->stats.AddMessage(msg);
787:   void ReadMissing(ThreadState* thread) {
792:       const int k = thread->rand.Next() % FLAGS_num;
795:       thread->stats.FinishedSingleOp();
799:   void ReadHot(ThreadState* thread) {
805:       const int k = thread->rand.Next() % range;
808:       thread->stats.FinishedSingleOp();
812:   void SeekRandom(ThreadState* thread) {
819:       const int k = thread->rand.Next() % FLAGS_num;
824:       thread->stats.FinishedSingleOp();
828:     thread->stats.AddMessage(msg);
831:   void DoDelete(ThreadState* thread, bool seq) {
838:         const int k = seq ? i+j : (thread->rand.Next() % FLAGS_num);
842:         thread->stats.FinishedSingleOp();
852:   void DeleteSeq(ThreadState* thread) {
853:     DoDelete(thread, true);
856:   void DeleteRandom(ThreadState* thread) {
857:     DoDelete(thread, false);
860:   void ReadWhileWriting(ThreadState* thread) {
861:     if (thread->tid > 0) {
862:       ReadRandom(thread);
864:       // Special thread that keeps writing until other threads are done.
868:           MutexLock l(&thread->shared->mu);
869:           if (thread->shared->num_done + 1 >= thread->shared->num_initialized) {
875:         const int k = thread->rand.Next() % FLAGS_num;
886:       thread->stats.Start();
890:   void Compact(ThreadState* thread) {
69: // Number of concurrent threads to run.
289:   int tid;             // 0..n-1 when running in n threads
290:   Random rand;         // Has different seeds for different threads
441:       void (Benchmark::*method)(ThreadState*) = NULL;
443:       int num_threads = FLAGS_threads;
526:         RunBenchmark(num_threads, name, method);
536:     void (Benchmark::*method)(ThreadState*);
540:     ThreadArg* arg = reinterpret_cast<ThreadArg*>(v);
568:                     void (Benchmark::*method)(ThreadState*)) {
575:     ThreadArg* arg = new ThreadArg[n];
582:       Env::Default()->StartThread(ThreadBody, &arg[i]);
870:             // Other threads have finished
949:     } else if (sscanf(argv[i], "--threads=%d%c", &n, &junk) == 1) {
950:       FLAGS_threads = n;
chromium.googlesource.com/chromiumos/third_party/minifakedns:src/miniFakeDns.py:[master, ]
100:   thread = threading.Thread(target=server.run, args=(stopper,))
72:     thread = threading.Thread(target=server.run, args=(stopper,))
102:     thread.start()
106:     print 'stopping thread'
108:   thread.join()
3: import logging, socket, threading, time
67:     """Runs DNSServer until the threading.Event object |stop| gets set.
71:     stopper = threading.Event()
99:   stopper = threading.Event()
github.com/google/kythe:third_party/leveldb/db/db_bench.cc:[master, ]
duplicate result
github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-ios:TicTacToeSample/GTMHTTPFetcher.h:[master, ]
duplicate result
github.com/googlearchive/solutions-mobile-backend-starter-ios-client:gtl/GTMHTTPFetcher.h:[master, ]
559: @property (retain) NSThread *thread;
474:   NSThread *thread_;
82: // Callbacks require either that the thread used to start the fetcher have a run
83: // loop spinning (typically the main thread), or that an NSOperationQueue be
86: // callbacks on a background thread:
92: // or specify the main queue for callbacks on the main thread:
557: // The thread used to run this fetcher in the fetcher service when no operation
80: // Threading and queue support:
github.com/MobileChromeApps/cordova-plugin-google-open-source-ios:GoogleOpenSource.framework/Versions/A/Headers/GTMHTTPFetcher.h:[master, ]
637: @property (retain) NSThread *thread;
534:   NSThread *thread_;
82: // Callbacks require either that the thread used to start the fetcher have a run
83: // loop spinning (typically the main thread), or that an NSOperationQueue be
86: // callbacks on a background thread:
92: // or specify the main queue for callbacks on the main thread:
635: // The thread used to run this fetcher in the fetcher service when no operation
814: // not supplied, and the fetcher is started off of the main thread, then a
80: // Threading and queue support: