Search some code: Max results:

Found 124830 results in 25297 files (30MB index data, 5052301 ngram matches, 566531 docs considered, 63280 docs (918MB) loaded, 502213 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 5.038689481s (queued: 4.567┬Ás)

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

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");
android.googlesource.com/platform/external/mockito:src/main/java/org/mockito/internal/util/concurrent/DetachedThreadLocal.java:[master, ] lang:java
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/tools/gpu:cc/gapic/thread.h:[master, ] lang:c++
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
github.com/fuchsia-mirror/third_party-re2:re2/nfa.cc:[master, ] lang:c++
64:   struct Thread {
88:   typedef SparseArray<Thread*> Threadq;
165: NFA::Thread* NFA::AllocThread() {
129:   Thread* free_threads_;  // free list
206: void NFA::AddToThreadq(Threadq* q, int id0, int c, int flag,
67:       Thread* next;  // when on free list
75:     Thread* t;  // if not null, set t0 = t before processing id
81:     AddState(int id, Thread* t)
90:   inline Thread* AllocThread();
91:   inline Thread* Incref(Thread* t);
92:   inline void Decref(Thread* t);
97:   // p is the current input position, and t0 is the current thread.
99:                     const char* p, Thread* t0);
157:   Thread* next;
158:   for (Thread* t = free_threads_; t; t = next) {
166:   Thread* t = free_threads_;
168:     t = new Thread;
178: NFA::Thread* NFA::Incref(Thread* t) {
184: void NFA::Decref(Thread* t) {
205: // p is the current input position, and t0 is the current thread.
207:                        const char* p, Thread* t0) {
228:       // t0 was a thread that we allocated and copied in order to
248:     Thread** tp = &q->find(id)->second;
250:     Thread* t;
338:     Thread* t = i->second;
435: // Returns whether haystack contains needle's memory.
436: static bool StringPieceContains(const StringPiece haystack, const StringPiece needle) {
437:   return haystack.begin() <= needle.begin() &&
438:          haystack.end() >= needle.end();
548:         Thread* t = i->second;
599:     // Start a new thread if there have not been any matches.
600:     // (No point in starting a new thread if there have been
620:       Thread* t = AllocThread();
85:   // Threadq is a list of threads.  The list is sorted by the order
98:   void AddToThreadq(Threadq* q, int id0, int c, int flag,
107:   // Frees all the threads on runq.
109:   inline int Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p);
123:   Threadq q0_, q1_;     // pre-allocated for Search.
151:   free_threads_ = NULL;
173:   free_threads_ = t->next;
191:   t->next = free_threads_;
192:   free_threads_ = t;
287:         t = AllocThread();
332: // Frees all the threads on runq.
334: int NFA::Step(Threadq* runq, Threadq* nextq, int c, int flag, const char* p) {
337:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
343:       // Can skip any threads started after our current best match.
402:           // Cut off the threads that can only find matches
404:           // rest of the current Threadq.
500:   Threadq* runq = &q0_;
501:   Threadq* nextq = &q1_;
547:       for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i) {
627:     // If all the threads have died, stop early.
637:   for (Threadq::iterator i = runq->begin(); i != runq->end(); ++i)
72:   // State for explicit stack in AddToThreadq.
126:   AddState* astack_;    // pre-allocated for AddToThreadq
144:   // See NFA::AddToThreadq() for why this is so.
254:       LOG(DFATAL) << "unhandled " << ip->opcode() << " in AddToThreadq";
360:         AddToThreadq(nextq, ip->out(), c, flag, p+1, t);
558:     // c and flag through to AddToThreadq() along with p-1+1, which is p.
623:       AddToThreadq(runq, start_, p < text.end() ? p[0] & 0xFF : -1, flag, p, t);
github.com/googlecreativelab/chrome-music-lab:harmonics & strings/js/Thread.js:[master, ] lang:javascript
5: var Thread = function(xp0Pm, yp0Pm, xp1Pm, yp1Pm, indPm, indHarmonicPm, isTopPm, threadControllerPm) {
1: // class:	Thread
52: 	// how close do we have to be to instantly grab a thread - perpendicular distance (px)
60: 	// total length of this thread (when unstretched)
131: Thread.prototype.init = function() {
140: Thread.prototype.redraw = function() {
185: Thread.prototype.upd = function() {
186: 	// is thread currently grabbed
189: 	// is thread currently oscillating
198: Thread.prototype.updOsc = function() {
248: Thread.prototype.updGrab = function() {
250: 	// is this thread being held by a fish?
291: Thread.prototype.stopNote = function() {
298: Thread.prototype.pluck = function(xp, yp, byUser, fish) {
366: Thread.prototype.grab = function(xp, yp, byUser, car) {
386: Thread.prototype.drop = function() {
416: Thread.prototype.startOsc = function() {
430: Thread.prototype.playNote = function(vol, pan) {
445: Thread.prototype.setStretch = function(r) {
452: // desc:      Check when user first clicks if they clicked right on top of a thread,
455: Thread.prototype.checkInstantGrab = function() {
479: // desc:      Check when user first clicks if they clicked right on top of a thread,
482: Thread.prototype.setPosition = function(x0, y0, x1, y1) {
6: 	this.m = threadControllerPm;
67: 	// my overall index number of all threads
278: 		this.m.dropThread(this);
474: 		this.m.grabThread(this, xu, yu, true, null);
android.googlesource.com/platform/external/regex-re2:re2/nfa.cc:[master, ] lang:c++
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, ] lang:javascript
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',
android.googlesource.com/platform/external/avahi:avahi-common/thread-watch.c:[master, ] lang:c
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, ] lang:java
1046:         public Thread thread;
93:     private static ReferenceQueueThread REFERENCE_QUEUE_THREAD;
917:         public synchronized void notifyWaitingThread(HostConfiguration configuration) {
928:         public synchronized void notifyWaitingThread(HostConnectionPool hostPool) {
1044:     private static class WaitingThread {
1061:     private static class ReferenceQueueThread extends Thread {
1068:         public ReferenceQueueThread() {
65: public class MultiThreadedHttpConnectionManager implements HttpConnectionManager {
256:     public MultiThreadedHttpConnectionManager() {
706:         private LinkedList waitingThreads = new LinkedList();
1034:         public LinkedList waitingThreads = new LinkedList();
91:      * The thread responsible for handling lost connections.
134:             if (REFERENCE_QUEUE_THREAD != null) {
135:                 REFERENCE_QUEUE_THREAD.shutdown();
136:                 REFERENCE_QUEUE_THREAD = null;
171:             // start the reference queue thread if needed
172:             if (REFERENCE_QUEUE_THREAD == null) {
173:                 REFERENCE_QUEUE_THREAD = new ReferenceQueueThread();
174:                 REFERENCE_QUEUE_THREAD.start();
507:                             waitingThread.thread = Thread.currentThread();
531:                             // interrupted by an external thread.  Regardless we need to 
624:      * If another thread is blocked in getConnection() that could use this
741:                 waiter.thread.interrupt();
912:          * Notifies a waiting thread that a connection for the given configuration is 
922:          * Notifies a waiting thread that a connection for the given configuration is 
923:          * available.  This will wake a thread waiting in this host pool or if there is not
924:          * one a thread in the connection pool will be notified.
930:             // find the thread we are going to notify, we want to ensure that each
931:             // waiting thread is only interrupted once so we will remove it from 
937:                     LOG.debug("Notifying thread waiting on host pool, hostConfig=" 
944:                     LOG.debug("No-one waiting on host pool, notifying next waiting thread.");
954:                 waitingThread.thread.interrupt();
1041:      * A simple struct-like class to combine the waiting thread and the connection 
1045:         /** The thread that is waiting for a connection */
1048:         /** The connection pool the thread is waiting for */
1051:         /** Flag to indicate if the thread was interrupted by the ConnectionPool. Set
1053:          * before the thread is interrupted. */
1058:      * A thread for listening for HttpConnections reclaimed by the garbage
1066:          * Create an instance and make this a daemon thread.
105:      * MultiThreadedHttpConnectionManager. All static resources are released, all threads are 
453:             WaitingThread waitingThread = null;
492:                     // threads, so they avoid being sacrificed before necessary
504:                         if (waitingThread == null) {
505:                             waitingThread = new WaitingThread();
506:                             waitingThread.hostConnectionPool = hostPool;
509:                             waitingThread.interruptedByConnectionPool = false;
516:                         hostPool.waitingThreads.addLast(waitingThread);
517:                         connectionPool.waitingThreads.addLast(waitingThread);
520:                         if (!waitingThread.interruptedByConnectionPool) {
529:                         if (!waitingThread.interruptedByConnectionPool) {
533:                             hostPool.waitingThreads.remove(waitingThread);
534:                             connectionPool.waitingThreads.remove(waitingThread);
735:             // interrupt all waiting threads
738:                 WaitingThread waiter = (WaitingThread) iter.next();
777:          * connection counts and notifies waiting threads, if appropriate.
787:             notifyWaitingThread(config);
915:          * @see #notifyWaitingThread(HostConnectionPool)
918:             notifyWaitingThread(getHostPool(configuration));
933:             WaitingThread waitingThread = null;
940:                 waitingThread = (WaitingThread) hostPool.waitingThreads.removeFirst();
941:                 waitingThreads.remove(waitingThread);
946:                 waitingThread = (WaitingThread) waitingThreads.removeFirst();
947:                 waitingThread.hostConnectionPool.waitingThreads.remove(waitingThread);
949:                 LOG.debug("Notifying no-one, there are no waiting threads");
952:             if (waitingThread != null) {
953:                 waitingThread.interruptedByConnectionPool = true;
1004:                 notifyWaitingThread(hostPool);
1052:          * to true inside {@link ConnectionPool#notifyWaitingThread(HostConnectionPool)} 
1115:                     LOG.debug("ReferenceQueueThread interrupted", e);
2:  * $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, ] lang:java
54: public class Thread implements Runnable {
187:   private static final String THREAD = "Thread-";
207:   public Thread() {
221:   public Thread(Runnable runnable) {
236:   public Thread(Runnable runnable, String threadName) {
249:   public Thread(String threadName) {
269:   public Thread(ThreadGroup group, Runnable runnable) {
291:   public Thread(ThreadGroup group, Runnable runnable, String threadName, long stack) {
312:   public Thread(ThreadGroup group, Runnable runnable, String threadName) {
330:   public Thread(ThreadGroup group, String threadName) {
334:   private Thread(
58:   private final Object nativeThread;
60:   private final long threadId;
68:   ThreadLocal.ThreadLocalMap threadLocals = null;
88:   private ThreadGroup threadGroup;
102:   private static long threadOrdinalNum = 1;
153:   long threadLocalRandomSeed;
154:   int threadLocalRandomProbe;
155:   int threadLocalRandomSecondarySeed;
196:   private static native Object newNativeThread() /*-[
379:   private static Thread createMainThread(Object nativeThread) {
394:   private static Thread createCurrentThread(Object nativeThread) {
398:   public static native Thread currentThread() /*-[
69:   ThreadLocal.ThreadLocalMap inheritableThreadLocals = null;
386:   private static native void initializeThreadClass() /*-[
553:   public ThreadGroup getThreadGroup() {
831:   private static synchronized long getNextThreadId() {
30: #import "java_lang_Thread.h"
46:  * Simplified iOS version of java.lang.Thread, based on Apache Harmony source
47:  * (both luni-kernel and vmcore). This class uses pthread for thread creation
49:  * pthread's thread local mechanism (pthread_setspecific) is used to associate
50:  * this wrapper object with the current thread.
80:   /** The object the thread is waiting on (normally null). */
83:   /** The object in which this thread is blocked in an interruptible I/O operation, if any. */
90:   /** the park state of the thread */
93:   /** The synchronization object responsible for this thread parking. */
100:    * Counter used to generate thread's ID
105:    * A representation of a thread's state. A given thread may only be in one
110:      * The thread has been created, but has never been started.
114:      * The thread may be run.
118:      * The thread is blocked and waiting for a lock.
122:      * The thread is waiting.
126:      * The thread is waiting for a specified amount of time.
130:      * The thread has been terminated.
149:     void uncaughtException(Thread t, Throwable e);
165:    * The maximum priority value allowed for a thread.
172:    * The minimum priority value allowed for a thread.
185:    * used to generate a default thread name
189:   // Milliseconds between polls for testing thread completion.
201:    * Constructs a new Thread with no runnable object and a newly generated
202:    * name. The new Thread will belong to the same ThreadGroup as the Thread
208:     this(null, null, THREAD, 0, null);
212:    * Constructs a new Thread with a runnable object and a newly generated
213:    * name. The new Thread will belong to the same ThreadGroup as the Thread
217:    *        be executed by the new Thread
222:     this(null, runnable, THREAD, 0, null);
226:    * Constructs a new Thread with a runnable object and name provided. The new
227:    * Thread will belong to the same ThreadGroup as the Thread calling this
231:    *        be executed by the new Thread
232:    * @param threadName Name for the Thread being created
241:    * Constructs a new Thread with no runnable object and the name provided.
242:    * The new Thread will belong to the same ThreadGroup as the Thread calling
245:    * @param threadName Name for the Thread being created
254:    * Constructs a new Thread with a runnable object and a newly generated
255:    * name. The new Thread will belong to the ThreadGroup passed as parameter.
257:    * @param group ThreadGroup to which the new Thread will belong
259:    *        be executed by the new Thread
270:     this(group, runnable, THREAD, 0, null);
274:    * Constructs a new Thread with a runnable object, the given name and
277:    * @param group ThreadGroup to which the new Thread will belong
279:    *        be executed by the new Thread
280:    * @param threadName Name for the Thread being created
296:    * Constructs a new Thread with a runnable object, the given name and
299:    * @param group ThreadGroup to which the new Thread will belong
301:    *        be executed by the new Thread
302:    * @param threadName Name for the Thread being created
317:    * Constructs a new Thread with no runnable object, the given name and
320:    * @param group ThreadGroup to which the new Thread will belong
321:    * @param threadName Name for the Thread being created
338:     if (name.equals(THREAD)) {
344:       // Thread is not yet started.
345:       Thread currentThread = currentThread();
352:       // Thread is already running.
363:     JavaLangThread *thread = (JavaLangThread *)arg;
364:     pthread_setspecific(java_thread_key, thread);
367:         [thread run];
369:         [thread rethrowWithJavaLangThrowable:t];
371:         [thread rethrowWithJavaLangThrowable:create_JavaLangThrowable_initWithNSString_(
380:     return new Thread(ThreadGroup.mainThreadGroup, null, "main", 0, nativeThread);
384:    * Create a Thread wrapper around the main native thread.
391:     pthread_setspecific(java_thread_key, [mainThread retain]);
395:     return new Thread(ThreadGroup.mainThreadGroup, null, THREAD, 0, nativeThread);
399:     JavaLangThread *thread = pthread_getspecific(java_thread_key);
400:     if (thread) {
401:       return thread;
405:     thread = JavaLangThread_createCurrentThreadWithId_(nt);
406:     pthread_setspecific(java_thread_key, [thread retain]);
407:     return thread;
412:       throw new IllegalThreadStateException("This thread was already started!");
474:    * stack for this Thread.
482:   public static int enumerate(Thread[] threads) {
483:     Thread thread = Thread.currentThread();
484:     return thread.getThreadGroup().enumerate(threads);
600:    * Posts an interrupt request to this {@code Thread}. Unless the caller is
604:    * the state of this {@code Thread}:
607:    * {@code Thread}s blocked in one of {@code Object}'s {@code wait()} methods
608:    * or one of {@code Thread}'s {@code join()} or {@code sleep()} methods will
612:    * {@code Thread}s blocked in an I/O operation of an
618:    * {@code Thread}s blocked in a {@link java.nio.channels.Selector} will have
627:    * @see Thread#interrupted
628:    * @see Thread#isInterrupted
658:    * Returns a <code>boolean</code> indicating whether the current Thread (
664:    * @see Thread#currentThread
665:    * @see Thread#interrupt
666:    * @see Thread#isInterrupted
669:     Thread currentThread = currentThread();
681:    * @see Thread#interrupt
682:    * @see Thread#interrupted
689:    * Blocks the current Thread (<code>Thread.currentThread()</code>) until
710:    * Blocks the current Thread (<code>Thread.currentThread()</code>) until
725:    * Blocks the current Thread (<code>Thread.currentThread()</code>) until
761:           // wait until this thread completes or the timeout has elapsed
811:           if (Thread.interrupted()) {
824:    * Causes the calling Thread to yield execution time to another Thread that
836:    * Indicates whether the current Thread has a monitor lock on the specified
840:    * @return true if the current thread has a monitor lock on the specified
848:    * Returns the context ClassLoader for this Thread.
864:       return "Thread[" + getName() + "," + getPriority() + "," + group.getName() + "]";
866:     return "Thread[" + getName() + "," + getPriority() + ",]";
870:    * Unparks this thread. This unblocks the thread it if it was
871:    * previously parked, or indicates that the thread is "preemptively
873:    * next time the thread is told to park, it will merely clear its
889:            * preemptively unparked thread is to remain in
909:    * Parks the current thread for a particular number of nanoseconds, or
910:    * indefinitely. If not indefinitely, this method unparks the thread
911:    * after the given number of nanoseconds if no other thread unparks it
912:    * first. If the thread has been "preemptively unparked," this method
914:    * also return spuriously (that is, without the thread being told to
921:    * thread.
967:    * Parks the current thread until the specified system time. This
968:    * method attempts to unpark the current thread immediately after
970:    * value, if no other thread unparks it first. If the thread has
973:    * spuriously (that is, without the thread being told to unpark
980:    * current thread.
982:    * @param time the time after which the thread should be unparked,
1017:    * exception terminates a thread.
1028:    * case any Thread dies due to an unhandled exception.
1034:       Thread.defaultUncaughtHandler = handler;
1038:    * Returns the handler invoked when this thread abruptly terminates
1039:    * due to an uncaught exception. If this thread has not had an
1040:    * uncaught exception handler explicitly set then this thread's
1041:    * <tt>ThreadGroup</tt> object is returned, unless this thread
1051:    * Set the handler invoked when this thread abruptly terminates
1053:    * <p>A thread can take full control of how it responds to uncaught
1055:    * If no such handler is set then the thread's <tt>ThreadGroup</tt>
1057:    * @param eh the object to use as this thread's uncaught exception
1058:    * handler. If <tt>null</tt> then this thread has no explicit handler.
1059:    * @throws  SecurityException  if the current thread is not allowed to
1060:    *          modify this thread.
1072:     public synchronized void uncaughtException(Thread t, Throwable e) {
1073:       System.err.print("Exception in thread \"" + t.getName() + "\" ");
1079:    * Adds a runnable to be invoked upon interruption. If this thread has
1121:   public static Map<Thread,StackTraceElement[]> getAllStackTraces() {
1122:     return Collections.<Thread, StackTraceElement[]>emptyMap();
32: #import <pthread.h>
36: @interface NativeThread : NSObject {
38:   pthread_t t;
41: @implementation NativeThread
48:  * and maintains a pthread handle for using other pthread functionality.
57:   /** Android source declares this as the native VMThread class. */
152:   // Fields accessed reflectively by ThreadLocalRandom.
179:    * The normal (default) priority value assigned to threads.
197:     return [[[NativeThread alloc] init] autorelease];
205:    * @see java.lang.ThreadGroup
218:    * @see java.lang.ThreadGroup
233:    * @see java.lang.ThreadGroup
237:     this(null, runnable, threadName, 0, null);
246:    * @see java.lang.ThreadGroup
250:     this(null, null, threadName, 0, null);
264:    * @see java.lang.ThreadGroup
275:    * belonging to the ThreadGroup passed as parameter.
286:    * @see java.lang.ThreadGroup
292:     this(group, runnable, threadName, stack, null);
297:    * belonging to the ThreadGroup passed as parameter.
307:    * @see java.lang.ThreadGroup
313:     this(group, runnable, threadName, 0, null);
318:    * belonging to the ThreadGroup passed as parameter.
326:    * @see java.lang.ThreadGroup
331:     this(group, null, threadName, 0, null);
335:       ThreadGroup group, Runnable runnable, String name, long stack, Object nativeThread) {
337:     this.threadId = getNextThreadId();
339:       name += threadId;
343:     if (nativeThread == null) {
346:       nativeThread = newNativeThread();
347:       this.priority = currentThread.getPriority();
349:         group = currentThread.getThreadGroup();
356:     this.threadGroup = group;
357:     this.nativeThread = nativeThread;
388:     NativeThread *nt = [[[NativeThread alloc] init] autorelease];
389:     nt->t = pthread_self();
390:     JavaLangThread *mainThread = JavaLangThread_createMainThreadWithId_(nt);
403:     NativeThread *nt = [[[NativeThread alloc] init] autorelease];
404:     nt->t = pthread_self();
414:     threadGroup.add(this);
423:     NativeThread *nt = (NativeThread *)self->nativeThread_;
424:     pthread_attr_t attr;
425:     pthread_attr_init(&attr);
427:     if (stack >= PTHREAD_STACK_MIN) {
428:       pthread_attr_setstacksize(&attr, stack);
430:     pthread_create(&nt->t, &attr, &start_routine, [self retain]);
435:     if (threadGroup != null) {
436:       threadGroup.threadTerminated(this);
437:       threadGroup = null;
461:       return currentThread().getThreadGroup().activeCount();
488:     return threadId;
508:     ThreadGroup g;
528:     param.sched_priority = (priority * 64 / JavaLangThread_MAX_PRIORITY) - 1;
529:     NativeThread *nt = (NativeThread *)self->nativeThread_;
530:     pthread_setschedparam(nt->t, SCHED_OTHER, &param);
554:     return state == STATE_TERMINATED ? null : threadGroup;
601:    * the {@link #currentThread()}, the method {@code checkAccess()} is called
631:     synchronized(nativeThread) {
659:    * <code>currentThread()</code>) has a pending interrupt request (<code>
670:     boolean result = currentThread.interrupted;
671:     currentThread.interrupted = false;
695:    * @see java.lang.ThreadDeath
702:       synchronized (nativeThread) {
704:               nativeThread.wait(POLL_INTERVAL);
718:    * @see java.lang.ThreadDeath
734:    * @see java.lang.ThreadDeath
753:       synchronized (nativeThread) {
765:                 nativeThread.wait(POLL_INTERVAL);
767:                 nativeThread.wait(millis, nanos);
817:       Object lock = currentThread().nativeThread;
828:     pthread_yield_np();
832:     return threadOrdinalNum++;
862:     ThreadGroup group = getThreadGroup();
882:     Object vmt = nativeThread;
930:     Object vmt = nativeThread;
988:     Object vmt = nativeThread;
1047:     return h != null ? h : threadGroup;
1062:    * @see ThreadGroup#uncaughtException
1118:    * Returns a map of stack traces for all live threads.
1127:     stop(new ThreadDeath());
193:     initializeThreadClass();
262:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
284:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
305:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
324:    * @throws IllegalThreadStateException if <code>group.destroy()</code> has
387:     initJavaThreadKeyOnce();
513:     if ((g = getThreadGroup()) != null) {
android.googlesource.com/platform/external/nist-sip:java/gov/nist/core/ThreadAuditor.java:[master, ] lang:java
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;
github.com/fuchsia-mirror/third_party-skia:dm/DM.cpp:[master, ] lang:c++
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();
github.com/google/skia:dm/DM.cpp:[master, ] lang:c++
146:     SkThreadID thread;
1052: static SkTaskGroup gDefinitelyThreadSafeWork;
202:         if (task.thread == thisThread) {
1027: static bool match(const char* needle, const char* haystack) {
1028:     if ('~' == needle[0]) {
1029:         return !match(needle + 1, haystack);
1031:     if (0 == strcmp("_", needle)) {
1034:     return nullptr != strstr(haystack, needle);
1051: // .png encoding are definitely thread safe.  This lets us offload that work to CPU threads.
1385:     // With the parallel work running, run serial tasks and tests here on main thread.
72: DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
200:     SkThreadID thisThread = SkGetThreadID();
864:                                FLAGS_gpu_threading);
1050: // Even when a Task Sink reports to be non-threadsafe (e.g. GPU), we know things like
1093:             // We're likely switching threads here, so we must capture by value, [=] or [foo,bar].
1247:             (FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test);
1327:     SkTaskGroup::Enabler enabled(FLAGS_threads);
1398:     // At this point we're back in single-threaded land.
40: #include "SkThreadUtils.h"
195:     gRunning.push_back({id,SkGetThreadID()});
1095:             gDefinitelyThreadSafeWork.add([task,name,bitmap,data]{
1391:     gDefinitelyThreadSafeWork.wait();
chromium.googlesource.com/skia:dm/DM.cpp:[master, ] lang:c++
duplicate result
github.com/google/perf_data_converter:third_party/chromiumos-wide-profiling/compat/ext/detail/thread.h:[master, ] lang:c++
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, ] lang:c++
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 {
android.googlesource.com/platform/external/swiftshader:src/Common/Thread.cpp:[master, ] lang:c++
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);
android.googlesource.com/platform/superproject:libcore/harmony-tests/src/test/java/org/apache/harmony/tests/org/apache/harmony/kernel/dalvik/ThreadsTest.java:[master, ] lang:java
262:         private final Thread thread;
29: public class ThreadsTest extends TestCase {
54:         Thread parkerThread = new Thread(parker);
55:         Thread waiterThread =
56:             new Thread(new WaitAndUnpark(barrier, 1000, parkerThread));
69:         Thread parkerThread = new Thread(parker);
70:         Thread waiterThread =
71:             new Thread(new WaitAndUnpark(barrier, 300, parkerThread));
80:     /** Test the case where the thread is preemptively unparked. */
84:         Thread parkerThread = new Thread(parker);
96:         Thread parkerThread = new Thread(parker);
97:         Thread waiterThread =
98:             new Thread(new WaitAndUnpark(barrier, 1000, parkerThread));
111:         Thread parkerThread = new Thread(parker);
112:         Thread waiterThread =
113:             new Thread(new WaitAndUnpark(barrier, 300, parkerThread));
122:     /** Test the case where the thread is preemptively unparked. */
126:         Thread parkerThread = new Thread(parker);
257:      * specified amount of time and then unparks an indicated thread.
264:         public WaitAndUnpark(CyclicBarrier barrier, long waitMillis, Thread thread) {
267:             this.thread = thread;
277:                 Thread.sleep(waitMillis);
282:             UNSAFE.unpark(thread);
58:         parkerThread.start();
59:         waiterThread.start();
61:         waiterThread.join();
62:         parkerThread.join();
73:         parkerThread.start();
74:         waiterThread.start();
76:         waiterThread.join();
77:         parkerThread.join();
86:         UNSAFE.unpark(parkerThread);
87:         parkerThread.start();
89:         parkerThread.join();
100:         parkerThread.start();
101:         waiterThread.start();
103:         waiterThread.join();
104:         parkerThread.join();
115:         parkerThread.start();
116:         waiterThread.start();
118:         waiterThread.join();
119:         parkerThread.join();
128:         UNSAFE.unpark(parkerThread);
129:         parkerThread.start();
131:         parkerThread.join();
gerrit.googlesource.com/prolog-cafe:src/repl/BlockingPrologControl.java:[master, ] lang:java
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>.
github.com/GoogleCloudPlatform/google-cloud-visualstudio:GoogleCloudExtension/ProjectTemplates/ProjectTemplate.Tests/VisualStudioWrapper.cs:[master, ] lang:c#
23: using Thread = System.Threading.Thread;
156:                 Thread.Sleep(200);
github.com/google/mtail:vm/vm.go:[master, ] lang:go
138: type thread struct {
149: // expressions), mutable state (metrics), and a stack for the current thread of
161: 	t *thread // Current thread of execution
171: func (t *thread) Push(value interface{}) {
176: func (t *thread) Pop() (value interface{}) {
190: 	glog.Infof("Thread:")
201: func (t *thread) PopInt() (int64, error) {
222: func (t *thread) PopFloat() (float64, error) {
363: // instruction, and returns a boolean indicating if the current thread should
365: func (v *VM) execute(t *thread, i instr) {
672: 	t := new(thread)
chromium.googlesource.com/infra/third_party/coverage:tests/test_concurrency.py:[master, ] lang:python
82:         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)
87:         THREAD = """\
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/fuchsia-mirror/traceviz:src/traceviz.h:[master, ] lang:c++
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, ] lang:objectivec
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, ] lang:python
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/googlearchive/appengine-try-python-flask:lib/werkzeug/serving.py:[master, ] lang:python
duplicate result
github.com/GoogleCloudPlatform/deepbreath:third_party/gmail.js:[master, ] lang:javascript
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, ] lang:javascript
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, ] lang:python
20:     import dummy_thread as thread
365: def psyco_start_new_thread(callable, args, kw=None):
371: original_start_new_thread = thread.start_new_thread
358: def psyco_thread_stub(callable, args, kw):
18:     import thread
32: # a lock for a thread-safe go()
33: go_lock = thread.allocate_lock()
260:         self.lock = thread.allocate_lock()
343: # and thread.start_new_thread().
366:     "This is the Psyco-aware version of thread.start_new_thread()."
367:     return original_start_new_thread(psyco_thread_stub, (callable, args, kw))
374: thread.start_new_thread = psyco_start_new_thread
375: # hack to patch threading._start_new_thread if the module is
378:     hasattr(sys.modules['threading'], '_start_new_thread')):
379:     sys.modules['threading']._start_new_thread = psyco_start_new_thread
204:             alarm.stop(1)   # wait for parallel threads to stop
377: if ('threading' in sys.modules and
go.googlesource.com/debug:macho/macho.go:[master, ] lang:go
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"},
github.com/googlearchive/cloud-playground:lib/werkzeug/serving.py:[master, ] lang:python
duplicate result
github.com/googlearchive/solutions-mobile-shopping-assistant-ios-client:GTLSource/GTMHTTPFetcher.h:[master, ] lang:objectivec
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/fuchsia-mirror/traceviz:src/ktrace.cpp:[master, ] lang:c++
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/fuchsia-mirror/magenta-rs:src/lib.rs:[master, ] lang:rust
46: mod thread;
259:     Thread = 2,
591:     fn thread_time_increases() {
58: pub use thread::Thread;
214:         // Task signals (process, thread, job)
257:     /// The number of nanoseconds the current thread has been running for. Corresponds to
258:     /// MX_CLOCK_THREAD.
592:         let time1 = time_get(ClockId::Thread);
594:         let time2 = time_get(ClockId::Thread);
chromium.googlesource.com/chromium/src/third_party/WebKit/Source/devtools:front_end/sdk/TracingModel.js:[master, ] lang:javascript
874: SDK.TracingModel.Thread = class extends SDK.TracingModel.NamedObject {
101:   static browserMainThread(tracingModel) {
299:   threadByName(processName, threadName) {
461:   ThreadSortIndex: 'thread_sort_index',
462:   ThreadName: 'thread_name'
833:   threadById(id) {
846:   threadByName(name) {
854:   _setThreadByName(name, thread) {
869:   sortedThreads() {
95:    * @return {?SDK.TracingModel.Thread}
120:       return tracingStartedInBrowser[0].thread;
121:     Common.console.error('Failed to find browser main thread in trace, some timeline features may be unavailable');
146:       for (var thread of process._threads.values())
147:         thread.tracingComplete();
163:       for (const thread of process._threads.values()) {
164:         for (const event of thread.events()) {
169:         for (const event of thread.asyncEvents()) {
217:     // chronological order. However, also add individual async events to the thread flow (above), so we can easily
297:    * @return {?SDK.TracingModel.Thread}
349:         event.thread._addAsyncEvent(asyncEvent);
385:       event.thread._addAsyncEvent(asyncEvent);
503:    * @param {!SDK.TracingModel.Thread} thread
505:   constructor(categories, name, phase, startTime, thread) {
509:     this._parsedCategories = thread._model._parsedCategoriesForString(categories);
516:     /** @type {!SDK.TracingModel.Thread} */
517:     this.thread = thread;
527:    * @param {!SDK.TracingModel.Thread} thread
530:   static fromPayload(payload, thread) {
532:         payload.cat, payload.name, /** @type {!SDK.TracingModel.Phase} */ (payload.ph), payload.ts / 1000, thread);
634:    * @param {!SDK.TracingModel.Thread} thread
636:   constructor(category, name, startTime, thread) {
637:     super(category, name, SDK.TracingModel.Phase.SnapshotObject, startTime, thread);
648:    * @param {!SDK.TracingModel.Thread} thread
651:   static fromPayload(payload, thread) {
652:     var snapshot = new SDK.TracingModel.ObjectSnapshot(payload.cat, payload.name, payload.ts / 1000, thread);
723:     super(startEvent.categoriesString, startEvent.name, startEvent.phase, startEvent.startTime, startEvent.thread);
817:     /** @type {!Map<number, !SDK.TracingModel.Thread>} */
831:    * @return {!SDK.TracingModel.Thread}
834:     var thread = this._threads.get(id);
835:     if (!thread) {
836:       thread = new SDK.TracingModel.Thread(this, id);
837:       this._threads.set(id, thread);
839:     return thread;
844:    * @return {?SDK.TracingModel.Thread}
852:    * @param {!SDK.TracingModel.Thread} thread
855:     this._threadByName.set(name, thread);
867:    * @return {!Array.<!SDK.TracingModel.Thread>}
116:       return browserProcesses[0].threadByName('CrBrowserMain');
202:     // We do allow records for unrelated threads to arrive out-of-order,
216:     // Build async event when we've got events from all threads & processes, so we can sort them and process in the
237:       case SDK.TracingModel.MetadataEvent.ThreadSortIndex:
238:         process.threadById(payload.tid)._setSortIndex(payload.args['sort_index']);
240:       case SDK.TracingModel.MetadataEvent.ThreadName:
241:         process.threadById(payload.tid)._setName(payload.args['name']);
296:    * @param {string} threadName
301:     return process && process.threadByName(threadName);
818:     this._threads = new Map();
819:     this._threadByName = new Map();
847:     return this._threadByName.get(name) || null;
863:     return this.threadById(payload.tid)._addEvent(payload);
870:     return SDK.TracingModel.NamedObject._sort(this._threads.valuesArray());
107:     var crRendererMainThreads = [];
111:       crRendererMainThreads.push(...process.sortedThreads().filter(t => t.name() === 'CrBrowserMain'));
113:     if (crRendererMainThreads.length === 1)
114:       return crRendererMainThreads[0];
951:     this._process._setThreadByName(name, this);
github.com/chromium/vim-codesearch:third_party/codesearch-py/codesearch/messages.py:[master, ] lang:python
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, ] lang:javascript
139:             needle: "Mauris"
194:             needle: "consectetur"
github.com/google/haskell-indexer:third_party/kythe/third_party/leveldb/db/db_bench.cc:[master, ] lang:c++
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;
github.com/google/kythe:third_party/leveldb/db/db_bench.cc:[master, ] lang:c++
duplicate result
github.com/GoogleCloudPlatform/appengine-endpoints-tictactoe-ios:TicTacToeSample/GTMHTTPFetcher.h:[master, ] lang:objectivec
duplicate result
github.com/googlearchive/solutions-mobile-backend-starter-ios-client:gtl/GTMHTTPFetcher.h:[master, ] lang:objectivec
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, ] lang:objectivec
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:
github.com/googlearchive/appengine-try-python-bottle:lib/bottle.py:[master, ] lang:python
79:     import _thread as thread
2717: class FileCheckerThread(threading.Thread):
94:     import thread
1483: #: Thread-local storage for :class:`LocalRequest` and :class:`LocalResponse`
1496:         'Thread-local property stored in :data:`_lctx.%s`' % name)
1500:     ''' A thread-local subclass of :class:`BaseRequest` with a different
1501:         set of attribues for each thread. There is usually only one global
1510:     ''' A thread-local subclass of :class:`BaseResponse` with a different
1511:         set of attribues for each thread. There is usually only one global
2435:             _stderr("         (Fapws3 breaks python thread support)\n")
2473:         thread_pool = ThreadPool()
2474:         thread_pool.start()
2475:         reactor.addSystemEventTrigger('after', 'shutdown', thread_pool.stop)
2476:         factory = server.Site(wsgi.WSGIResource(reactor, thread_pool, handler))
2718:     ''' Interrupt main-thread as soon as a changed module file is detected,
2722:         threading.Thread.__init__(self)
2741:                 thread.interrupt_main()
2745:                     thread.interrupt_main()
2843:         must match self.encoding. This method must be thread-safe!
3212: #: A thread-safe instance of :class:`LocalRequest`. If accessed from within a
3217: #: A thread-safe instance of :class:`LocalResponse`. It is used to change the
3221: #: A thread-safe namespace. Not used by Bottle.
39:         os, re, subprocess, sys, tempfile, threading, time, urllib, warnings
1485: _lctx = threading.local()
2471:         from twisted.python.threadpool import ThreadPool
2697:             bgcheck = FileCheckerThread(lockfile, interval)
2872:         self.context = threading.local()
3222: local = threading.local()
1504:         request (even on a multithreaded server). '''
3214: #: (even on a multithreaded server).
github.com/fuchsia-mirror/fidl:compiler/legacy_generators/pylib/mojom/generate/module.py:[master, ] lang:python
112: THREAD                = ReferenceKind('h:t')
125: NULLABLE_THREAD       = ReferenceKind('?h:t', True)
533: def IsThreadKind(kind):
51:     if self == THREAD:
52:       return NULLABLE_THREAD
152:   THREAD,
165:   NULLABLE_THREAD,
534:   return (kind.spec == THREAD.spec or kind.spec == NULLABLE_THREAD.spec)
603:           IsThreadKind(kind) or
chromium.googlesource.com/chromium/src/third_party/WebKit/Source/devtools:front_end/performance_test_runner/TimelineTestRunner.js:[master, ] lang:javascript
38:   thread: 'formatAsTypeName',
188:   for (let event of PerformanceTestRunner.timelineModel().mainThreadEvents()) {
195:   for (let event of PerformanceTestRunner.timelineModel().mainThreadEvents()) {
277:   return PerformanceTestRunner.timelineModel().mainThreadEvents().filter(e => e.name === name)[index || 0];
293:     'cpuTime', 'duration', 'startTime', 'endTime', 'id', 'mainThreadFrameId', 'timeByCategory', 'other', 'scripting',
chromium.googlesource.com/webm/udpsample:receivedecompressandplay.cpp:[master, ] lang:c++
87: HANDLE thread;
88: DWORD thread_id;
373: static int event_thread(void *data) {
285: SDL_Thread *mythread;
143:   thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) display_win_main,
144:                         (LPVOID) NULL, 0, &thread_id);
258: #include <SDL/SDL_thread.h>
276: static int event_thread(void *data);
323:   /* initialize thread data */
329:   mythread = SDL_CreateThread(event_thread, (void *) &ptdata);
1208:   /* Message loop for display window's thread */
133:     ExitThread(-1);
368:   SDL_WaitThread(mythread, &status);
github.com/webmproject/udpsample:receivedecompressandplay.cpp:[master, ] lang:c++
duplicate result
github.com/fuchsia-mirror/third_party-mako:mako/compat.py:[master, ] lang:python
113:         import _thread as thread
119:         import _dummy_thread as thread
121:         import dummy_thread as thread  # noqa
117:     import dummy_threading as threading  # noqa
115:         import thread
111:     import threading
chromium.googlesource.com/infra/third_party/waitress:waitress/compat.py:[master, ] lang:python
71:     import _thread as thread
69:     import thread
chromium.googlesource.com/infra/third_party/Pygments:tests/examplefiles/Intro.java:[master, ] lang:java
258:         private Thread thread;
267:                     if (thread == null) start(); else stop();
296:                 if (thread != null) {
308:                 if (thread != null) {
320:             if (thread == null) {
321:                 thread = new Thread(this);
322:                 thread.setPriority(Thread.MIN_PRIORITY);
323:                 thread.setName("Intro");
324:                 thread.start();
330:             if (thread != null) {
331:                 thread.interrupt();
333:             thread = null;
349:             Thread me = Thread.currentThread();
351:             while (thread == me && !isShowing() || getSize().width <= 0) {
353:                     thread.sleep(500);
361:             while (thread == me) {
366:                         thread.sleep(sleepAmt);
369:                         scene.pause(thread);
380:             thread = null;
554:             public void pause(Thread thread) {
556:                     thread.sleep(Long.parseLong((String) pauseAmt));