Home
last modified time | relevance | path

Searched refs:Thread (Results 1 – 25 of 218) sorted by relevance

123456789

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/
DThreadTest.java20 import java.lang.Thread.UncaughtExceptionHandler;
63 Thread parent;
75 Thread.sleep(100); in run()
82 Thread.sleep(500); in run()
86 while (!Thread.currentThread().isInterrupted()) { in run()
89 Thread.sleep(50); in run()
102 public ResSupThread(Thread t) { in ResSupThread()
120 Thread st, ct, spinner;
127 ct = new Thread(new SimpleThread(10)); in test_ConstructorLjava_lang_Runnable()
137 Thread st1 = new Thread(new SimpleThread(1), "SimpleThread1"); in test_ConstructorLjava_lang_RunnableLjava_lang_String()
[all …]
DThreadGroupTest.java27 private Thread.UncaughtExceptionHandler originalThreadDefaultUncaughtExceptionHandler;
31 initialThreadGroup = Thread.currentThread().getThreadGroup(); in setUp()
42 originalThreadDefaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); in setUp()
44 Thread.setDefaultUncaughtExceptionHandler(testThreadDefaultUncaughtExceptionHandler); in setUp()
50 Thread.setDefaultUncaughtExceptionHandler(originalThreadDefaultUncaughtExceptionHandler); in tearDown()
80 newGroup.getParent() == Thread.currentThread().getThreadGroup()); in test_ConstructorLjava_lang_ThreadGroupLjava_lang_String()
103 Thread t1 = new Thread(tg, new Runnable() { in test_activeCount()
106 Thread.sleep(5000); in test_activeCount()
181 Thread noOp = new Thread(testRoot, null, "no-op thread") { in test_destroy()
200 noOp = new Thread(testRoot, null, "no-op thread") { in test_destroy()
[all …]
/libcore/luni/src/test/java/libcore/java/lang/
DOldThreadTest.java51 st = new Thread(tg, new SimpleThread(1), "SimpleThread3", 1); in test_ConstructorLjava_lang_ThreadGroupLjava_lang_RunnableLjava_lang_StringL$L()
62 new Thread(tg, new SimpleThread(1), "SimpleThread3", in test_ConstructorLjava_lang_ThreadGroupLjava_lang_RunnableLjava_lang_StringL$L()
76 Thread.dumpStack(); in test_dumpStack()
90 boolean b = Thread.holdsLock(this); in enterLocked()
95 boolean b = Thread.holdsLock(this); in enterNonLocked()
104 final Thread parker = new Thread() { in test_joinWithSpuriousInterruption()
113 Thread unparker = new Thread() { in test_joinWithSpuriousInterruption()
118 Thread.sleep(100); in test_joinWithSpuriousInterruption()
137 st = new Thread(); in test_setContextClassLoader()
146 st = new Thread(new SimpleThread(5)); in test_setDaemonZ()
[all …]
DOldThreadStateTest.java23 Thread.State [] exStates = { Thread.State.NEW, Thread.State.RUNNABLE,
24 Thread.State.BLOCKED, Thread.State.WAITING,
25 Thread.State.TIMED_WAITING, Thread.State.TERMINATED };
32 assertEquals(exStates[i], Thread.State.valueOf(spNames[i])); in test_valueOfLString()
38 Thread.State.valueOf(s); in test_valueOfLString()
47 Thread.State [] thStates = Thread.State.values(); in test_values()
49 for(Thread.State ts:thStates) { in test_values()
54 boolean isContain(Thread.State state) { in isContain()
55 for(Thread.State ts:exStates) { in isContain()
DThreadTest.java32 Thread.currentThread().getContextClassLoader()); in testJavaContextClassLoader()
65 Thread.sleep(millis); in testThreadSleep()
74 Thread.currentThread().interrupt(); in testThreadInterrupted()
76 Thread.sleep(0); in testThreadInterrupted()
79 assertFalse(Thread.currentThread().isInterrupted()); in testThreadInterrupted()
86 Thread.sleep(-1); in testThreadSleepIllegalArguments()
92 Thread.sleep(0, -1); in testThreadSleepIllegalArguments()
98 Thread.sleep(0, 1000000); in testThreadSleepIllegalArguments()
115 Thread.sleep(1000); in testThreadWakeup()
120 assertNotNull(Thread.currentThread().getContextClassLoader()); in testContextClassLoaderIsNotNull()
[all …]
DOldThreadGroupTest.java27 public class OldThreadGroupTest extends TestCase implements Thread.UncaughtExceptionHandler {
29 class MyThread extends Thread {
42 Thread.sleep(50); in run()
58 Thread.yield(); in isActivelyRunning()
75 Thread t1 = new Thread(tg, new Runnable() { in test_activeGroupCount()
105 private boolean inListOfThreads(Thread[] threads) { in inListOfThreads()
107 if (Thread.currentThread() == threads[i]) { in inListOfThreads()
117 Thread[] listOfThreads = new Thread[numThreads]; in test_enumerateLThreadArray()
128 Thread[] initialThreads = new Thread[initialThreadCount]; in test_enumerateLThreadArrayLZtest_enumerateLThreadArrayLZ()
142 Thread.sleep(500); // starting threads isn't instant! in test_enumerateLThreadArrayLZtest_enumerateLThreadArrayLZ()
[all …]
/libcore/jsr166-tests/src/test/java/jsr166/
DThreadTest.java15 static class MyHandler implements Thread.UncaughtExceptionHandler {
16 public void uncaughtException(Thread t, Throwable e) { in uncaughtException()
28 Thread current = Thread.currentThread(); in testGetAndSetUncaughtExceptionHandler()
51 Thread current = Thread.currentThread(); in testGetAndSetDefaultUncaughtExceptionHandler()
54 Thread.setDefaultUncaughtExceptionHandler(eh); in testGetAndSetDefaultUncaughtExceptionHandler()
55 assertEquals(eh, Thread.getDefaultUncaughtExceptionHandler()); in testGetAndSetDefaultUncaughtExceptionHandler()
56 Thread.setDefaultUncaughtExceptionHandler(null); in testGetAndSetDefaultUncaughtExceptionHandler()
60 assertEquals(null, Thread.getDefaultUncaughtExceptionHandler()); in testGetAndSetDefaultUncaughtExceptionHandler()
DPhaserTest.java298 List<Thread> threads = new ArrayList<Thread>(); in testArrive2()
307 for (Thread thread : threads) in testArrive2()
414 Thread t = newStartedThread(new CheckedRunnable() {
453 Thread t1 = newStartedThread(new CheckedRunnable() {
455 Thread.currentThread().interrupt();
460 assertFalse(Thread.interrupted());
467 assertFalse(Thread.interrupted());
470 Thread t2 = newStartedThread(new CheckedRunnable() {
472 Thread.currentThread().interrupt();
477 assertFalse(Thread.interrupted());
[all …]
DSystemTest.java29 Thread.sleep(1); in testNanoTime1()
31 Thread.sleep(SHORT_DELAY_MS); in testNanoTime1()
33 Thread.sleep(1); in testNanoTime1()
49 Thread.sleep(1); in testNanoTime2()
51 Thread.sleep(SHORT_DELAY_MS); in testNanoTime2()
53 Thread.sleep(1); in testNanoTime2()
DLockSupportTest.java100 Thread t = newStartedThread(new CheckedRunnable() { in testParkBeforeUnpark()
135 Thread t = newStartedThread(new CheckedRunnable() { in testParkAfterUnpark()
139 Thread.yield(); in testParkAfterUnpark()
172 Thread t = newStartedThread(new CheckedRunnable() { in testParkBeforeInterrupt()
178 } while (! Thread.currentThread().isInterrupted()); in testParkBeforeInterrupt()
211 Thread t = newStartedThread(new CheckedRunnable() { in testParkAfterInterrupt()
215 Thread.yield(); in testParkAfterInterrupt()
216 assertTrue(Thread.currentThread().isInterrupted()); in testParkAfterInterrupt()
218 assertTrue(Thread.currentThread().isInterrupted()); in testParkAfterInterrupt()
243 Thread t = newStartedThread(new CheckedRunnable() { in testParkTimesOut()
[all …]
DCyclicBarrierTest.java35 Thread.yield(); in awaitNumberWaiting()
99 Thread t = newStartedThread(new CheckedRunnable() { in testTwoParties()
121 Thread t1 = new ThreadShouldThrow(InterruptedException.class) { in testAwait1_Interrupted_BrokenBarrier()
126 Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { in testAwait1_Interrupted_BrokenBarrier()
147 Thread t1 = new ThreadShouldThrow(InterruptedException.class) { in testAwait2_Interrupted_BrokenBarrier()
152 Thread t2 = new ThreadShouldThrow(BrokenBarrierException.class) { in testAwait2_Interrupted_BrokenBarrier()
171 Thread t = newStartedThread(new CheckedRunnable() { in testAwait3_TimeoutException()
190 Thread t1 = newStartedThread(new CheckedRunnable() { in testAwait4_Timeout_BrokenBarrier()
197 Thread t2 = newStartedThread(new CheckedRunnable() { in testAwait4_Timeout_BrokenBarrier()
218 Thread t1 = newStartedThread(new CheckedRunnable() { in testAwait5_Timeout_BrokenBarrier()
[all …]
DCountDownLatchTest.java57 Thread t = newStartedThread(new CheckedRunnable() { in testAwait()
82 Thread t = newStartedThread(new CheckedRunnable() { in testTimedAwait()
106 Thread t = newStartedThread(new CheckedRunnable() { in testAwait_Interruptible()
108 Thread.currentThread().interrupt(); in testAwait_Interruptible()
113 assertFalse(Thread.interrupted()); in testAwait_Interruptible()
120 assertFalse(Thread.interrupted()); in testAwait_Interruptible()
137 Thread t = newStartedThread(new CheckedRunnable() { in testTimedAwait_Interruptible()
139 Thread.currentThread().interrupt(); in testTimedAwait_Interruptible()
144 assertFalse(Thread.interrupted()); in testTimedAwait_Interruptible()
151 assertFalse(Thread.interrupted()); in testTimedAwait_Interruptible()
[all …]
DAbstractQueuedLongSynchronizerTest.java116 static final Thread[] NO_THREADS = new Thread[0];
122 Thread t) { in waitForQueuedThread()
127 Thread.yield(); in waitForQueuedThread()
136 Thread... expected) { in assertHasQueuedThreads()
137 Collection<Thread> actual = sync.getQueuedThreads(); in assertHasQueuedThreads()
142 assertEquals(new HashSet<Thread>(actual), in assertHasQueuedThreads()
143 new HashSet<Thread>(Arrays.asList(expected))); in assertHasQueuedThreads()
150 Thread... expected) { in assertHasExclusiveQueuedThreads()
152 assertEquals(new HashSet<Thread>(sync.getExclusiveQueuedThreads()), in assertHasExclusiveQueuedThreads()
153 new HashSet<Thread>(sync.getQueuedThreads())); in assertHasExclusiveQueuedThreads()
[all …]
DAbstractQueuedSynchronizerTest.java120 static final Thread[] NO_THREADS = new Thread[0];
125 void waitForQueuedThread(AbstractQueuedSynchronizer sync, Thread t) { in waitForQueuedThread()
130 Thread.yield(); in waitForQueuedThread()
139 Thread... expected) { in assertHasQueuedThreads()
140 Collection<Thread> actual = sync.getQueuedThreads(); in assertHasQueuedThreads()
145 assertEquals(new HashSet<Thread>(actual), in assertHasQueuedThreads()
146 new HashSet<Thread>(Arrays.asList(expected))); in assertHasQueuedThreads()
153 Thread... expected) { in assertHasExclusiveQueuedThreads()
155 assertEquals(new HashSet<Thread>(sync.getExclusiveQueuedThreads()), in assertHasExclusiveQueuedThreads()
156 new HashSet<Thread>(sync.getQueuedThreads())); in assertHasExclusiveQueuedThreads()
[all …]
DExchangerTest.java25 Thread t1 = newStartedThread(new CheckedRunnable() { in testExchange()
30 Thread t2 = newStartedThread(new CheckedRunnable() { in testExchange()
45 Thread t1 = newStartedThread(new CheckedRunnable() { in testTimedExchange()
50 Thread t2 = newStartedThread(new CheckedRunnable() { in testTimedExchange()
66 Thread t = newStartedThread(new CheckedInterruptedRunnable() { in testExchange_InterruptedException()
83 Thread t = newStartedThread(new CheckedInterruptedRunnable() { in testTimedExchange_InterruptedException()
99 Thread t = newStartedThread(new CheckedRunnable() { in testExchange_TimeoutException()
119 Thread t1 = newStartedThread(new CheckedInterruptedRunnable() { in testReplacementAfterExchange()
125 Thread t2 = newStartedThread(new CheckedRunnable() { in testReplacementAfterExchange()
132 Thread t3 = newStartedThread(new CheckedRunnable() { in testReplacementAfterExchange()
/libcore/dalvik/src/main/java/dalvik/system/profiler/
DSamplingProfiler.java107 private Thread[] currentThreads = new Thread[0];
114 private final Map<Thread, Integer> threadIds = new HashMap<Thread, Integer>();
185 public Thread[] threads(); in threads()
195 public static ThreadSet newArrayThreadSet(Thread... threads) { in newArrayThreadSet()
204 private final Thread[] threads;
205 public ArrayThreadSet(Thread... threads) { in ArrayThreadSet()
211 public Thread[] threads() { in threads()
231 private Thread[] threads;
248 threads = new Thread[count*2]; in resize()
252 public Thread[] threads() { in threads()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/org/apache/harmony/kernel/dalvik/
DThreadsTest.java54 Thread parkerThread = new Thread(parker); in test_parkFor_1()
55 Thread waiterThread = in test_parkFor_1()
56 new Thread(new WaitAndUnpark(barrier, 1000, parkerThread)); in test_parkFor_1()
69 Thread parkerThread = new Thread(parker); in test_parkFor_2()
70 Thread waiterThread = in test_parkFor_2()
71 new Thread(new WaitAndUnpark(barrier, 300, parkerThread)); in test_parkFor_2()
84 Thread parkerThread = new Thread(parker); in test_parkFor_3()
96 Thread parkerThread = new Thread(parker); in test_parkUntil_1()
97 Thread waiterThread = in test_parkUntil_1()
98 new Thread(new WaitAndUnpark(barrier, 1000, parkerThread)); in test_parkUntil_1()
[all …]
/libcore/libart/src/main/java/java/lang/
DThreadGroup.java31 public class ThreadGroup implements Thread.UncaughtExceptionHandler {
38 private int maxPriority = Thread.MAX_PRIORITY;
48 private final List<WeakReference<Thread>> threadRefs = new ArrayList<WeakReference<Thread>>(5);
54 private final Iterable<Thread> threads = CollectionUtils.dereferenceIterable(threadRefs, true);
79 this(Thread.currentThread().getThreadGroup(), name); in ThreadGroup()
125 for (Thread thread : threads) { in activeCount()
266 public int enumerate(Thread[] threads) { in enumerate()
283 public int enumerate(Thread[] threads, boolean recurse) { in enumerate()
342 Thread thread = threadRefs.get(i).get(); in enumerateGeneric()
414 for (Thread thread : threads) { in interrupt()
[all …]
DThread.java59 public class Thread implements Runnable { class
198 public Thread() { in Thread() method in Thread
214 public Thread(Runnable runnable) { in Thread() method in Thread
232 public Thread(Runnable runnable, String threadName) { in Thread() method in Thread
252 public Thread(String threadName) { in Thread() method in Thread
276 public Thread(ThreadGroup group, Runnable runnable) { in Thread() method in Thread
296 public Thread(ThreadGroup group, Runnable runnable, String threadName) { in Thread() method in Thread
317 public Thread(ThreadGroup group, String threadName) { in Thread() method in Thread
346 public Thread(ThreadGroup group, Runnable runnable, String threadName, long stackSize) { in Thread() method in Thread
360 Thread(ThreadGroup group, String name, int priority, boolean daemon) { in Thread() method in Thread
[all …]
/libcore/luni/src/main/java/java/util/concurrent/locks/
DLockSupport.java101 (java.lang.Thread.class.getDeclaredField("parkBlocker"));
105 private static void setBlocker(Thread t, Object arg) { in setBlocker()
121 public static void unpark(Thread thread) { in unpark()
155 Thread t = Thread.currentThread(); in park()
195 Thread t = Thread.currentThread(); in parkNanos()
236 Thread t = Thread.currentThread(); in parkUntil()
254 public static Object getBlocker(Thread t) { in getBlocker()
DReentrantLock.java101 final Thread current = Thread.currentThread(); in nonfairTryAcquire()
121 if (Thread.currentThread() != getExclusiveOwnerThread()) in tryRelease()
135 return getExclusiveOwnerThread() == Thread.currentThread(); in isHeldExclusively()
144 final Thread getOwner() { in getOwner()
178 setExclusiveOwnerThread(Thread.currentThread()); in lock()
203 final Thread current = Thread.currentThread(); in tryAcquire()
586 protected Thread getOwner() { in getOwner()
615 public final boolean hasQueuedThread(Thread thread) { in hasQueuedThread()
644 protected Collection<Thread> getQueuedThreads() { in getQueuedThreads()
711 protected Collection<Thread> getWaitingThreads(Condition condition) { in getWaitingThreads()
[all …]
DReentrantReadWriteLock.java251 final long tid = Thread.currentThread().getId();
306 private transient Thread firstReader = null;
364 Thread current = Thread.currentThread(); in tryAcquire()
385 Thread current = Thread.currentThread(); in tryReleaseShared()
436 Thread current = Thread.currentThread(); in tryAcquireShared()
467 final int fullTryAcquireShared(Thread current) { in fullTryAcquireShared()
528 Thread current = Thread.currentThread(); in tryWriteLock()
549 Thread current = Thread.currentThread(); in tryReadLock()
580 return getExclusiveOwnerThread() == Thread.currentThread(); in isHeldExclusively()
589 final Thread getOwner() { in getOwner()
[all …]
DAbstractQueuedSynchronizer.java445 volatile Thread thread;
484 Node(Thread thread, Node mode) { // Used by addWaiter in Node()
489 Node(Thread thread, int waitStatus) { // Used by Condition in Node()
585 Node node = new Node(Thread.currentThread(), mode); in addWaiter()
804 Thread.currentThread().interrupt(); in selfInterrupt()
814 return Thread.interrupted(); in parkAndCheckInterrupt()
912 if (Thread.interrupted()) in doAcquireNanos()
1015 if (Thread.interrupted()) in doAcquireSharedNanos()
1196 if (Thread.interrupted()) in acquireInterruptibly()
1221 if (Thread.interrupted()) in tryAcquireNanos()
[all …]
DAbstractQueuedLongSynchronizer.java215 volatile Thread thread;
254 Node(Thread thread, Node mode) { // Used by addWaiter in Node()
259 Node(Thread thread, int waitStatus) { // Used by Condition in Node()
355 Node node = new Node(Thread.currentThread(), mode); in addWaiter()
574 Thread.currentThread().interrupt(); in selfInterrupt()
584 return Thread.interrupted(); in parkAndCheckInterrupt()
682 if (Thread.interrupted()) in doAcquireNanos()
785 if (Thread.interrupted()) in doAcquireSharedNanos()
966 if (Thread.interrupted()) in acquireInterruptibly()
991 if (Thread.interrupted()) in tryAcquireNanos()
[all …]
/libcore/luni/src/test/java/libcore/java/io/
DInterruptedStreamTest.java52 Thread.interrupted(); in setUp()
61 Thread.interrupted(); // clear interrupted bit in tearDown()
121 Thread thread = interruptMeLater(); in testInterruptInputStream()
132 Thread thread = interruptMeLater(); in testInterruptReader()
143 Thread thread = interruptMeLater(); in testInterruptReadableChannel()
154 Thread thread = interruptMeLater(); in testInterruptOutputStream()
167 Thread thread = interruptMeLater(); in testInterruptWriter()
180 Thread thread = interruptMeLater(); in testInterruptWritableChannel()
193 private Thread interruptMeLater() throws Exception { in interruptMeLater()
194 final Thread toInterrupt = Thread.currentThread(); in interruptMeLater()
[all …]

123456789