Searched refs:thread (Results 1 - 25 of 52) sorted by relevance

123

/libcore/ojluni/src/main/java/java/io/
H A DSerialCallbackContext.java33 * This context keeps track of the thread it was constructed on, and allows
35 * or writeFields which must be invoked on the same thread before the class's
37 * If not set to the current thread, the getObj method throws NotActiveException.
44 * As this only works in one thread, we do not need to worry about thread-safety.
46 private Thread thread; field in class:SerialCallbackContext
51 this.thread = Thread.currentThread();
64 if (thread != null && thread != Thread.currentThread()) {
66 "expected thread
[all...]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/
H A DLoadLocaleProviderTestHelper.java29 Thread thread = new Thread(this);
30 thread.setContextClassLoader(loader);
31 thread.start();
32 thread.join();
/libcore/ojluni/src/main/java/java/util/concurrent/locks/
H A DAbstractOwnableSynchronizer.java39 * A synchronizer that may be exclusively owned by a thread. This
67 * Sets the thread that currently owns exclusive access.
68 * A {@code null} argument indicates that no thread owns access.
71 * @param thread the owner thread
73 protected final void setExclusiveOwnerThread(Thread thread) { argument
74 exclusiveOwnerThread = thread;
78 * Returns the thread last set by {@code setExclusiveOwnerThread},
81 * @return the owner thread
H A DLockSupport.java39 * Basic thread blocking primitives for creating locks and other
42 * <p>This class associates, with each thread that uses it, a permit
58 * between one thread invoking {@code park} and another thread trying
61 * thread was interrupted, and timeout versions are supported. The
71 * the thread is blocked to permit monitoring and diagnostic tools to
90 * where no actions by the thread publishing a request to unpark,
92 * Because only one permit is associated with each thread, any
94 * loading, could lead to an unresponsive thread (a "lost unpark").
106 * // publish current thread fo
154 unpark(Thread thread) argument
[all...]
/libcore/luni/src/test/java/libcore/java/io/
H A DInterruptedStreamTest.java40 * Test that interrupting a thread blocked on I/O causes that thread to throw
121 Thread thread = interruptMeLater();
127 confirmInterrupted(thread);
132 Thread thread = interruptMeLater();
138 confirmInterrupted(thread);
143 Thread thread = interruptMeLater();
149 confirmInterrupted(thread);
154 Thread thread = interruptMeLater();
162 confirmInterrupted(thread);
208 confirmInterrupted(Thread thread) argument
[all...]
/libcore/luni/src/test/java/libcore/java/util/logging/
H A DOldLogRecordTest.java52 // Create and start the thread
53 MockThread thread = new MockThread();
54 thread.start();
56 thread.join();
70 assertTrue(lr.getThreadID() != thread.lr.getThreadID());
72 assertTrue(thread.lr.getThreadID() != thread2.lr.getThreadID());
76 public LogRecord lr = null; //will be update by the thread
83 lr = new LogRecord(Level.CONFIG, "msg thread");
/libcore/luni/src/test/java/libcore/java/lang/
H A DOldInheritableThreadLocalTest.java38 Thread thread = new Thread() {
43 thread.start();
44 thread.join();
H A DOldThreadGroupTest.java70 // A thread that runs in initialThreadGroup throughout each test.
98 ThreadGroup tg = new ThreadGroup("thread suspension");
111 assertTrue("Initial thread must be in enumeration of threads",
129 for(MyThread thread : newThreads) {
130 thread.start();
143 for(MyThread thread : newThreads) {
144 thread.interrupt();
254 assertFalse("Incorrect state of thread", interrupted);
256 assertFalse("Incorrect state of thread", interrupted);
262 assertTrue("Incorrect state of thread", interrupte
[all...]
H A DThreadTest.java255 fail("Current thread was parked, but was expected to return immediately");
263 * Check that call Thread.start for already started thread
268 Thread thread = new Thread() {
270 // Lock should be acquired by the main thread and
271 // this thread should block on this operation.
275 // Acquire lock to ensure that new thread is not finished
279 thread.start();
281 thread.start();
289 thread.join();
295 * Check that call Thread.start for already finished thread
[all...]
H A DOldThreadTest.java53 assertTrue("Constructed incorrect thread", (st.getThreadGroup() == tg)
151 fail("setDaemon() must throw exception for started thread");
158 Thread thread = new Thread() {
168 thread.start();
170 return thread;
392 Thread thread = launchFiveSecondDummyThread();
401 thread.stop();
419 Thread thread = new Thread() {
429 thread.start();
437 thread
[all...]
/libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/func/
H A DTestThread.java34 Thread thread = null;
38 thread = new Thread(this);
39 thread.start();
41 thread.join();
H A DCipherThread.java75 Thread thread = null;
83 thread = new Thread(this);
84 thread.start();
86 thread.join();
/libcore/ojluni/src/main/native/
H A DNativeThread.c43 #include <thread.h>
92 NativeThread_signal(JNIEnv *env, jclass cl, jlong thread) argument
96 ret = thr_kill((thread_t)thread, INTERRUPT_SIGNAL);
98 ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
/libcore/luni/src/test/java/libcore/java/nio/channels/
H A DOldServerSocketChannelTest.java97 MyThread thread = new MyThread();
98 thread.start();
101 thread.interrupt();
105 if (thread.errMsg != null) {
106 fail(thread.errMsg);
/libcore/libart/src/main/java/java/lang/
H A DDaemons.java69 private Thread thread; field in class:Daemons.Daemon
87 if (thread != null) {
90 thread = new Thread(ThreadGroup.systemThreadGroup, this, name);
91 thread.setDaemon(true);
92 thread.start();
109 * Returns true while the current thread should continue to run; false
113 return thread != null;
117 interrupt(thread);
120 public synchronized void interrupt(Thread thread) { argument
121 if (thread
460 interrupt(Thread thread) argument
[all...]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/
H A DThreadGroupTest.java181 Thread noOp = new Thread(testRoot, null, "no-op thread") {
188 // Wait for the no-op thread to run inside daemon ThreadGroup
197 assertTrue("Daemon group should have been destroyed already when last thread died", passed);
200 noOp = new Thread(testRoot, null, "no-op thread") {
211 // Has to execute the next lines in an interval < the sleep interval of the no-op thread
221 // But after the thread dies, we have to be able to destroy the thread group
285 // To maintain the invariant that a thread in the Vector is parent
512 Thread thread = new Thread(testRoot, null, "suicidal thread") {
763 waitForThreadToDieUninterrupted(Thread thread) argument
776 private Thread thread; field in class:ThreadGroupTest.TestThreadDefaultUncaughtExceptionHandler
779 uncaughtException(Thread thread, Throwable ex) argument
785 assertWasCalled(Thread thread, Throwable ex) argument
[all...]
H A DProcessManagerTest.java31 Thread thread = null; field in class:ProcessManagerTest
60 thread = new Thread() {
85 thread.interrupt();
88 thread.start();
101 thread.interrupt();
138 Thread thread = new Thread() {
153 thread.setDaemon(true);
154 thread.start();
/libcore/ojluni/src/main/java/sun/nio/ch/
H A DSinkChannelImpl.java49 // ID of native thread doing write, for signalling
50 private volatile long thread = 0; field in class:SinkChannelImpl
52 // Lock held by current reading thread
55 // Lock held by any thread that modifies the state fields declared below
89 long th = thread;
165 thread = NativeThread.current();
171 thread = 0;
188 thread = NativeThread.current();
194 thread = 0;
H A DSourceChannelImpl.java50 // ID of native thread doing read, for signalling
51 private volatile long thread = 0; field in class:SourceChannelImpl
53 // Lock held by current reading thread
56 // Lock held by any thread that modifies the state fields declared below
90 long th = thread;
169 thread = NativeThread.current();
175 thread = 0;
200 thread = NativeThread.current();
206 thread = 0;
/libcore/ojluni/src/main/java/java/util/
H A DTimer.java33 * background thread. Tasks may be scheduled for one-time execution, or for
37 * thread that is used to execute all of the timer's tasks, sequentially.
39 * to complete, it "hogs" the timer's task execution thread. This can, in
46 * execution thread terminates gracefully (and becomes subject to garbage
48 * default, the task execution thread does not run as a <i>daemon thread</i>,
50 * wants to terminate a timer's task execution thread rapidly, the caller
53 * <p>If the timer's task execution thread terminates unexpectedly, for
59 * <p>This class is thread-safe: multiple threads can share a single
68 * ScheduledThreadPoolExecutor} which is a thread poo
108 private final TimerThread thread = new TimerThread(queue); field in class:Timer
[all...]
/libcore/luni/src/test/java/libcore/java/net/
H A DOldDatagramPacketTest.java32 Thread thread = new Thread(new Runnable() {
40 System.out.println("thread exception: " + e);
44 thread.start();
/libcore/ojluni/src/main/java/java/util/concurrent/
H A DFutureTask.java106 /** The thread running the callable; CASed during run() */
354 volatile Thread thread; field in class:FutureTask.WaitNode
356 WaitNode() { thread = Thread.currentThread(); }
368 Thread t = q.thread;
370 q.thread = null;
411 q.thread = null;
466 node.thread = null;
471 if (q.thread != null)
475 if (pred.thread == null) // check for race
H A DPhaser.java92 * waiting thread is interrupted. Interruptible and timeout
507 * parent, and initial phase number 0. Any thread using this
743 * @throws InterruptedException if thread interrupted while waiting
778 * @throws InterruptedException if thread interrupted while waiting
970 Thread t; // its thread
975 (t = q.thread) != null) {
976 q.thread = null;
997 if (q == null || ((t = q.thread) != null && q.phase == p))
1000 q.thread = null;
1014 * avoid it when threads regularly arrive: When a thread i
1092 volatile Thread thread; // nulled to cancel wait field in class:Phaser.QNode
[all...]
/libcore/jsr166-tests/src/test/java/jsr166/
H A DJSR166TestCase.java85 * them. These methods are used to clear and check for thread
92 * small amounts of computation (creating a thread, calling a few
247 Thread thread = new Thread(checkForWedgedTest, "checkForWedgedTest");
248 thread.setDaemon(true);
249 thread.start();
622 * harness thread, triggering a test case failure. Only the first
646 * Triggers test case failure if any thread assertions have failed,
647 * by rethrowing, in the test harness thread, any exception recorded
650 * Triggers test case failure if interrupt status is set in the main thread.
670 tearDownFail("interrupt status set in main thread");
983 assertThreadStaysAlive(Thread thread) argument
990 assertThreadStaysAlive(Thread thread, long millis) argument
1212 waitForThreadToEnterWaitState(Thread thread, long timeoutMillis) argument
1235 waitForThreadToEnterWaitState( Thread thread, long timeoutMillis, Callable<Boolean> waitingForGodot) argument
1264 waitForThreadToEnterWaitState(Thread thread) argument
1273 waitForThreadToEnterWaitState( Thread thread, Callable<Boolean> waitingForGodot) argument
[all...]
H A DPhaserTest.java318 for (Thread thread : threads)
319 awaitTermination(thread);
639 for (Thread thread : threads)
640 awaitTermination(thread);
670 for (Thread thread : threads)
671 awaitTermination(thread);
745 for (Thread thread : threads)
746 awaitTermination(thread);
765 * for when the main thread awaitsAdvance
786 for (Thread thread
[all...]

Completed in 1477 milliseconds

123