Lines Matching refs:thread

47  *     lock count   thread id  hash state  0
66 * Only one thread can own the monitor at any time. There may be several
73 Thread* owner; /* which thread currently owns the lock? */
148 * Returns the thread id of the thread owning the given lock.
170 * Get the thread that holds the lock on the specified object. The
173 * The caller must lock the thread list before calling here.
185 * Checks whether the given thread holds the given
188 bool dvmHoldsLock(Thread* thread, Object* obj)
190 if (thread == NULL || obj == NULL) {
193 return thread->threadId == lockOwner(obj);
279 /* When a thread is being destroyed it is normal that the frame depth is zero */
299 /* Emit the sensitive thread ("main thread") status, 5 bytes. */
306 /* Emit self thread name string, <= 37 bytes. */
496 * Links a thread into a monitor's wait set. The monitor lock must be
499 static void waitSetAppend(Monitor *mon, Thread *thread)
505 assert(thread != NULL);
506 assert(thread->waitNext == NULL);
509 mon->waitSet = thread;
516 elt->waitNext = thread;
520 * Unlinks a thread from a monitor's wait set. The monitor lock must
523 static void waitSetRemove(Monitor *mon, Thread *thread)
529 assert(thread != NULL);
534 if (mon->waitSet == thread) {
535 mon->waitSet = thread->waitNext;
536 thread->waitNext = NULL;
541 if (elt->waitNext == thread) {
542 elt->waitNext = thread->waitNext;
543 thread->waitNext = NULL;
601 * If another thread calls Thread.interrupt(), we throw InterruptedException
634 "object not locked by thread before wait()");
662 * fields so the subroutine can check that the calling thread owns
677 * Update thread status. If the GC wakes up, it'll ignore us, knowing
690 * When waitMonitor is non-NULL a notifying or interrupting thread
691 * must signal the thread's waitCond to wake it up.
697 * Handle the case where the thread was interrupted before we called
738 * We remove our thread from wait set after restoring the count
740 * thread owns the monitor. Aside from that, the order of member
755 * un-interruptible thread earlier and we're bailing out immediately.
757 * The doc sayeth: "The interrupted status of the current thread is
768 * Notify one thread waiting on this monitor.
772 Thread* thread;
780 "object not locked by thread before notify()");
783 /* Signal the first waiting thread in the wait set. */
785 thread = mon->waitSet;
786 mon->waitSet = thread->waitNext;
787 thread->waitNext = NULL;
788 dvmLockMutex(&thread->waitMutex);
789 /* Check to see if the thread is still waiting. */
790 if (thread->waitMonitor != NULL) {
791 pthread_cond_signal(&thread->waitCond);
792 dvmUnlockMutex(&thread->waitMutex);
795 dvmUnlockMutex(&thread->waitMutex);
804 Thread* thread;
812 "object not locked by thread before notifyAll()");
817 thread = mon->waitSet;
818 mon->waitSet = thread->waitNext;
819 thread->waitNext = NULL;
820 dvmLockMutex(&thread->waitMutex);
821 /* Check to see if the thread is still waiting. */
822 if (thread->waitMonitor != NULL) {
823 pthread_cond_signal(&thread->waitCond);
825 dvmUnlockMutex(&thread->waitMutex);
831 * internal lock state. The calling thread must own the lock.
883 * The calling thread owns the lock. Increment the
897 * The lock is unowned. Install the thread id of the
898 * calling thread into the owner field. This is the
914 * The lock is owned by another thread. Notify the VM
925 * Check the shape of the lock word. Another thread
932 * thread id of the calling thread into the
947 * the owning thread can run.
969 * The thin lock was inflated by another thread.
1021 * by the given thread before unlocking it.
1083 "object not locked by thread before wait()");
1087 /* This thread holds the lock. We need to fatten the lock
1090 * any other thread gets a chance.
1114 "object not locked by thread before notify()");
1142 "object not locked by thread before notifyAll()");
1186 void dvmThreadInterrupt(Thread* thread)
1188 assert(thread != NULL);
1190 dvmLockMutex(&thread->waitMutex);
1196 if (thread->interrupted == true) {
1197 dvmUnlockMutex(&thread->waitMutex);
1206 thread->interrupted = true;
1209 * Is the thread waiting?
1212 * is only set when a thread actually waits on a monitor,
1215 if (thread->waitMonitor != NULL) {
1216 pthread_cond_signal(&thread->waitCond);
1219 dvmUnlockMutex(&thread->waitMutex);
1233 Thread *self, *thread;
1284 * this fail, we must suspend the owning thread.
1316 * identify the owning thread and suspend it.
1326 * Find the thread with the corresponding thread id.
1332 * thread list and fall through to the failure handler.
1334 thread = owner ? gDvm.threadList : NULL;
1335 while (thread != NULL) {
1336 if (thread->threadId == owner) {
1339 thread = thread->next;
1342 thread = LW_MONITOR(lock)->owner;
1345 * If thread is NULL the object has been released since the
1346 * thread list lock was acquired. Try again.
1348 if (thread == NULL) {
1353 * Wait for the owning thread to suspend.
1355 dvmSuspendThread(thread);
1356 if (dvmHoldsLock(thread, obj)) {
1358 * The owning thread has been suspended. We can safely
1362 dvmResumeThread(thread);
1367 * The wrong thread has been suspended. Try again.
1369 dvmResumeThread(thread);