3 #if defined(NATIVE_THREADS)
24 #include "exceptions.h"
25 #include "toolbox/logging.h"
26 #include "toolbox/memory.h"
27 #include "toolbox/avl.h"
30 #include "nat/java_lang_Object.h"
31 #include "nat/java_lang_Throwable.h"
32 #include "nat/java_lang_Thread.h"
33 #include "nat/java_lang_ThreadGroup.h"
34 #include "nat/java_lang_VMThread.h"
37 #include <semaphore.h>
39 #if !defined(__DARWIN__)
40 #if defined(__LINUX__)
41 #define GC_LINUX_THREADS
42 #elif defined(__MIPS__)
43 #define GC_IRIX_THREADS
45 #include "../mm/boehm-gc/include/gc.h"
50 /* We need this for older MacOSX (10.1.x) */
53 pthread_mutex_t mutex;
56 } pthread_mutex_rec_t;
58 static void pthread_mutex_init_rec(pthread_mutex_rec_t *m)
60 pthread_mutex_init(&m->mutex, NULL);
64 static void pthread_mutex_destroy_rec(pthread_mutex_rec_t *m)
66 pthread_mutex_destroy(&m->mutex);
69 static void pthread_mutex_lock_rec(pthread_mutex_rec_t *m)
74 pthread_mutex_lock(&m->mutex);
75 m->owner = pthread_self();
79 if (m->owner != pthread_self())
80 pthread_mutex_lock(&m->mutex);
89 static void pthread_mutex_unlock_rec(pthread_mutex_rec_t *m)
92 pthread_mutex_unlock(&m->mutex);
97 #define pthread_mutex_lock_rec pthread_mutex_lock
98 #define pthread_mutex_unlock_rec pthread_mutex_unlock
99 #define pthread_mutex_rec_t pthread_mutex_t
101 #endif /* MUTEXSIM */
103 static void setPriority(pthread_t tid, int priority)
105 struct sched_param schedp;
108 pthread_getschedparam(tid, &policy, &schedp);
109 schedp.sched_priority = priority;
110 pthread_setschedparam(tid, policy, &schedp);
113 #include "machine-instr.h"
115 static struct avl_table *criticaltree;
116 static threadobject *mainthreadobj;
118 #ifndef HAVE___THREAD
119 pthread_key_t tkey_threadinfo;
121 __thread threadobject *threadobj;
124 static pthread_mutex_rec_t compiler_mutex;
125 static pthread_mutex_rec_t tablelock;
129 pthread_mutex_lock_rec(&compiler_mutex);
132 void compiler_unlock()
134 pthread_mutex_unlock_rec(&compiler_mutex);
139 pthread_mutex_lock_rec(&tablelock);
144 pthread_mutex_unlock_rec(&tablelock);
147 static int criticalcompare(const void *pa, const void *pb, void *param)
149 const threadcritnode *na = pa;
150 const threadcritnode *nb = pb;
152 if (na->mcodebegin < nb->mcodebegin)
154 if (na->mcodebegin > nb->mcodebegin)
159 static const threadcritnode *findcritical(u1 *mcodeptr)
161 struct avl_node *n = criticaltree->avl_root;
162 const threadcritnode *m = NULL;
167 const threadcritnode *d = n->avl_data;
168 if (mcodeptr == d->mcodebegin)
170 if (mcodeptr < d->mcodebegin) {
176 if (n->avl_link[1]) {
185 void thread_registercritical(threadcritnode *n)
187 avl_insert(criticaltree, n);
190 u1 *thread_checkcritical(u1 *mcodeptr)
192 const threadcritnode *n = findcritical(mcodeptr);
193 return (n && mcodeptr < n->mcodeend && mcodeptr > n->mcodebegin) ? n->mcoderestart : NULL;
196 static void thread_addstaticcritical()
198 threadcritnode *n = &asm_criticalsections;
200 while (n->mcodebegin)
201 thread_registercritical(n++);
204 static pthread_mutex_t threadlistlock;
206 static pthread_mutex_t stopworldlock;
207 volatile int stopworldwhere;
209 static sem_t suspend_ack;
210 #if defined(__MIPS__)
211 static pthread_mutex_t suspend_ack_lock = PTHREAD_MUTEX_INITIALIZER;
212 static pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
216 * where - 1 from within GC
219 void lock_stopworld(int where)
221 pthread_mutex_lock(&stopworldlock);
222 stopworldwhere = where;
225 void unlock_stopworld()
228 pthread_mutex_unlock(&stopworldlock);
231 #if !defined(__DARWIN__)
232 /* Caller must hold threadlistlock */
233 static int cast_sendsignals(int sig, int count)
236 threadobject *tobj = mainthreadobj;
237 nativethread *infoself = THREADINFO;
242 tobj = tobj->info.next;
243 } while (tobj != mainthreadobj);
246 nativethread *info = &tobj->info;
247 if (info != infoself)
248 pthread_kill(info->tid, sig);
249 tobj = tobj->info.next;
250 } while (tobj != mainthreadobj);
257 static void cast_darwinstop()
259 threadobject *tobj = mainthreadobj;
260 nativethread *infoself = THREADINFO;
263 nativethread *info = &tobj->info;
264 if (info != infoself)
266 thread_state_flavor_t flavor = PPC_THREAD_STATE;
267 mach_msg_type_number_t thread_state_count = PPC_THREAD_STATE_COUNT;
268 ppc_thread_state_t thread_state;
269 mach_port_t thread = info->mach_thread;
272 r = thread_suspend(thread);
273 if (r != KERN_SUCCESS)
274 panic("thread_suspend failed");
276 r = thread_get_state(thread, flavor,
277 (natural_t*)&thread_state, &thread_state_count);
278 if (r != KERN_SUCCESS)
279 panic("thread_get_state failed");
281 thread_restartcriticalsection(&thread_state);
283 r = thread_set_state(thread, flavor,
284 (natural_t*)&thread_state, thread_state_count);
285 if (r != KERN_SUCCESS)
286 panic("thread_set_state failed");
288 tobj = tobj->info.next;
289 } while (tobj != mainthreadobj);
292 static void cast_darwinresume()
294 threadobject *tobj = mainthreadobj;
295 nativethread *infoself = THREADINFO;
298 nativethread *info = &tobj->info;
299 if (info != infoself)
301 r = thread_resume(thread);
302 if (r != KERN_SUCCESS)
303 panic("thread_resume failed");
305 tobj = tobj->info.next;
306 } while (tobj != mainthreadobj);
311 #if defined(__MIPS__)
312 static void cast_irixresume()
314 pthread_mutex_lock(&suspend_ack_lock);
315 pthread_cond_broadcast(&suspend_cond);
316 pthread_mutex_unlock(&suspend_ack_lock);
320 void cast_stopworld()
324 pthread_mutex_lock(&threadlistlock);
325 #if defined(__DARWIN__)
328 count = cast_sendsignals(GC_signum1(), 0);
329 for (i=0; i<count; i++)
330 sem_wait(&suspend_ack);
332 pthread_mutex_unlock(&threadlistlock);
335 void cast_startworld()
337 pthread_mutex_lock(&threadlistlock);
338 #if defined(__DARWIN__)
340 #elif defined(__MIPS__)
343 cast_sendsignals(GC_signum2(), -1);
345 pthread_mutex_unlock(&threadlistlock);
349 #if !defined(__DARWIN__)
350 static void sigsuspend_handler(ucontext_t *ctx)
355 thread_restartcriticalsection(ctx);
357 /* Do as Boehm does. On IRIX a condition variable is used for wake-up
358 (not POSIX async-safe). */
359 #if defined(__MIPS__)
360 pthread_mutex_lock(&suspend_ack_lock);
361 sem_post(&suspend_ack);
362 pthread_cond_wait(&suspend_cond, &suspend_ack_lock);
363 pthread_mutex_unlock(&suspend_ack_lock);
365 sem_post(&suspend_ack);
369 sigdelset(&sigs, sig);
374 int cacao_suspendhandler(ucontext_t *ctx)
376 if (stopworldwhere != 2)
379 sigsuspend_handler(ctx);
384 static void setthreadobject(threadobject *thread)
386 #if !defined(HAVE___THREAD)
387 pthread_setspecific(tkey_threadinfo, thread);
393 static monitorLockRecord *dummyLR;
395 static void initPools();
398 * Initialize threads.
404 pthread_mutexattr_t mutexattr;
405 pthread_mutexattr_init(&mutexattr);
406 pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
407 pthread_mutex_init(&compiler_mutex, &mutexattr);
408 pthread_mutex_init(&tablelock, &mutexattr);
409 pthread_mutexattr_destroy(&mutexattr);
411 pthread_mutex_init_rec(&compiler_mutex);
412 pthread_mutex_init_rec(&tablelock);
415 pthread_mutex_init(&threadlistlock, NULL);
416 pthread_mutex_init(&stopworldlock, NULL);
418 /* Allocate something so the garbage collector's signal handlers are */
420 heap_allocate(1, false, NULL);
422 mainthreadobj = NEW(threadobject);
423 memset(mainthreadobj, 0, sizeof(threadobject));
424 mainthreadobj->info.tid = pthread_self();
425 #if !defined(HAVE___THREAD)
426 pthread_key_create(&tkey_threadinfo, NULL);
428 setthreadobject(mainthreadobj);
431 criticaltree = avl_create(criticalcompare, NULL, NULL);
432 thread_addstaticcritical();
433 sem_init(&suspend_ack, 0, 0);
435 /* Every newly created object's monitorPtr points here so we save a check
437 dummyLR = mem_alloc(sizeof(monitorLockRecord));
439 dummyLR->ownerThread = NULL;
440 dummyLR->waiting = false;
443 static pthread_attr_t threadattr;
445 static void freeLockRecordPools(lockRecordPool *);
448 initThreads(u1 *stackbottom)
450 classinfo *threadclass;
451 classinfo *threadgroupclass;
452 java_lang_String *threadname;
453 java_lang_Thread *mainthread;
454 java_lang_ThreadGroup *threadgroup;
455 threadobject *tempthread = mainthreadobj;
458 threadclass = class_new(utf_new_char("java/lang/VMThread"));
459 class_load(threadclass);
460 class_link(threadclass);
463 throw_exception_exit();
465 freeLockRecordPools(mainthreadobj->ee.lrpool);
466 /* This is kinda tricky, we grow the java.lang.Thread object so we can keep
467 * the execution environment there. No Thread object must have been created
468 * at an earlier time */
469 threadclass->instancesize = sizeof(threadobject);
471 /* Create a VMThread */
472 mainthreadobj = (threadobject *) builtin_new(threadclass);
475 throw_exception_exit();
477 FREE(tempthread, threadobject);
478 initThread(&mainthreadobj->o);
480 setthreadobject(mainthreadobj);
483 mainthreadobj->info.next = mainthreadobj;
484 mainthreadobj->info.prev = mainthreadobj;
486 threadname = javastring_new(utf_new_char("main"));
488 /* Allocate and init ThreadGroup */
489 threadgroupclass = class_new(utf_new_char("java/lang/ThreadGroup"));
491 (java_lang_ThreadGroup *) native_new_and_init(threadgroupclass);
494 throw_exception_exit();
496 /* Create a Thread */
497 threadclass = class_new(utf_new_char("java/lang/Thread"));
498 mainthread = (java_lang_Thread*) builtin_new(threadclass);
499 mainthreadobj->o.thread = mainthread;
502 throw_exception_exit();
504 /* Call Thread constructor */
505 method = class_resolveclassmethod(threadclass,
506 utf_new_char("<init>"),
507 utf_new_char("(Ljava/lang/VMThread;Ljava/lang/String;IZ)V"),
512 throw_exception_exit();
514 asm_calljavafunction(method, mainthread, mainthreadobj, threadname, (void*) 5);
516 throw_exception_exit();
518 mainthread->group = threadgroup;
519 /* XXX This is a hack because the fourth argument was omitted */
520 mainthread->daemon = false;
522 /* Add mainthread to ThreadGroup */
523 method = class_resolveclassmethod(threadgroupclass,
524 utf_new_char("addThread"),
525 utf_new_char("(Ljava/lang/Thread;)V"),
530 throw_exception_exit();
532 asm_calljavafunction(method, threadgroup, mainthread, NULL, NULL);
534 throw_exception_exit();
536 /* TODO InheritableThreadLocal */
538 setPriority(pthread_self(), 5);
540 pthread_attr_init(&threadattr);
541 pthread_attr_setdetachstate(&threadattr, PTHREAD_CREATE_DETACHED);
544 void initThread(java_lang_VMThread *t)
546 threadobject *thread = (threadobject*) t;
547 nativethread *info = &thread->info;
548 info->tid = pthread_self();
549 pthread_mutex_init(&info->joinMutex, NULL);
550 pthread_cond_init(&info->joinCond, NULL);
552 thread->interrupted = 0;
553 thread->waiting = NULL;
556 static void initThreadLocks(threadobject *);
559 threadobject *thread;
563 static void *threadstartup(void *t)
565 startupinfo *startup = t;
566 threadobject *thread = startup->thread;
567 sem_t *psem = startup->psem;
568 nativethread *info = &thread->info;
573 #if defined(__DARWIN__)
574 info->mach_thread = mach_thread_self();
576 setthreadobject(thread);
578 pthread_mutex_lock(&threadlistlock);
579 info->prev = mainthreadobj;
580 info->next = tnext = mainthreadobj->info.next;
581 mainthreadobj->info.next = thread;
582 tnext->info.prev = thread;
583 pthread_mutex_unlock(&threadlistlock);
585 initThreadLocks(thread);
590 setPriority(info->tid, thread->o.thread->priority);
592 /* Find the run()V method and call it */
593 method = class_resolveclassmethod(thread->o.header.vftbl->class,
596 thread->o.header.vftbl->class,
599 /* if method != NULL, we had not exception */
601 asm_calljavafunction(method, thread, NULL, NULL, NULL);
607 /* Allow lock record pools to be used by other threads. They cannot be
608 * deleted so we'd better not waste them. */
609 freeLockRecordPools(thread->ee.lrpool);
611 pthread_mutex_lock(&threadlistlock);
612 info->next->info.prev = info->prev;
613 info->prev->info.next = info->next;
614 pthread_mutex_unlock(&threadlistlock);
616 pthread_mutex_lock(&info->joinMutex);
618 pthread_mutex_unlock(&info->joinMutex);
619 pthread_cond_broadcast(&info->joinCond);
624 void startThread(thread *t)
626 nativethread *info = &((threadobject*) t->vmThread)->info;
630 startup.thread = (threadobject*) t->vmThread;
633 sem_init(&sem, 0, 0);
635 if (pthread_create(&info->tid, &threadattr, threadstartup, &startup))
636 panic("pthread_create failed");
638 /* Wait here until the thread has entered itself into the thread list */
643 /* At the end of the program, we wait for all running non-daemon threads to die
646 static threadobject *findNonDaemon(threadobject *thread)
648 while (thread != mainthreadobj) {
649 if (!thread->o.thread->daemon)
651 thread = thread->info.prev;
657 void joinAllThreads()
659 threadobject *thread;
660 pthread_mutex_lock(&threadlistlock);
661 while ((thread = findNonDaemon(mainthreadobj->info.prev)) != NULL) {
662 nativethread *info = &thread->info;
663 pthread_mutex_lock(&info->joinMutex);
664 pthread_mutex_unlock(&threadlistlock);
666 pthread_cond_wait(&info->joinCond, &info->joinMutex);
667 pthread_mutex_unlock(&info->joinMutex);
668 pthread_mutex_lock(&threadlistlock);
670 pthread_mutex_unlock(&threadlistlock);
673 static void initLockRecord(monitorLockRecord *r, threadobject *t)
680 r->incharge = &dummyLR;
682 sem_init(&r->queueSem, 0, 0);
683 pthread_mutex_init(&r->resolveLock, NULL);
684 pthread_cond_init(&r->resolveWait, NULL);
685 pthread_mutex_init(&r->waitLock, NULL);
686 pthread_cond_init(&r->waitCond, NULL);
689 /* No lock record must ever be destroyed because there may still be references
692 static void destroyLockRecord(monitorLockRecord *r)
694 sem_destroy(&r->queueSem);
695 pthread_mutex_destroy(&r->resolveLock);
696 pthread_cond_destroy(&r->resolveWait);
697 pthread_mutex_destroy(&r->waitLock);
698 pthread_cond_destroy(&r->waitCond);
704 initThreadLocks(mainthreadobj);
707 static void initThreadLocks(threadobject *thread)
709 thread->ee.firstLR = NULL;
710 thread->ee.lrpool = NULL;
711 thread->ee.numlr = 0;
714 static lockRecordPool *allocNewLockRecordPool(threadobject *thread, int size)
716 lockRecordPool *p = mem_alloc(sizeof(lockRecordPoolHeader) + sizeof(monitorLockRecord) * size);
719 p->header.size = size;
720 for (i=0; i<size; i++) {
721 initLockRecord(&p->lr[i], thread);
722 p->lr[i].nextFree = &p->lr[i+1];
724 p->lr[i-1].nextFree = NULL;
728 #define INITIALLOCKRECORDS 8
730 static pthread_mutex_t pool_lock;
731 static lockRecordPool *global_pool;
733 static void initPools()
735 pthread_mutex_init(&pool_lock, NULL);
738 static lockRecordPool *allocLockRecordPool(threadobject *t, int size)
740 pthread_mutex_lock(&pool_lock);
743 lockRecordPool *pool = global_pool;
744 global_pool = pool->header.next;
745 pthread_mutex_unlock(&pool_lock);
747 for (i=0; i < pool->header.size; i++)
748 pool->lr[i].ownerThread = t;
752 pthread_mutex_unlock(&pool_lock);
754 return allocNewLockRecordPool(t, size);
757 static void freeLockRecordPools(lockRecordPool *pool)
759 lockRecordPoolHeader *last;
760 pthread_mutex_lock(&pool_lock);
761 last = &pool->header;
763 last = &last->next->header;
764 last->next = global_pool;
766 pthread_mutex_unlock(&pool_lock);
769 static monitorLockRecord *allocLockRecordSimple(threadobject *t)
771 monitorLockRecord *r = t->ee.firstLR;
774 int poolsize = t->ee.numlr ? t->ee.numlr * 2 : INITIALLOCKRECORDS;
775 lockRecordPool *pool = allocLockRecordPool(t, poolsize);
776 pool->header.next = t->ee.lrpool;
779 t->ee.numlr += pool->header.size;
782 t->ee.firstLR = r->nextFree;
786 static inline void recycleLockRecord(threadobject *t, monitorLockRecord *r)
788 r->nextFree = t->ee.firstLR;
792 void initObjectLock(java_objectheader *o)
794 o->monitorPtr = dummyLR;
797 static void queueOnLockRecord(monitorLockRecord *lr, java_objectheader *o)
799 atomic_add(&lr->queuers, 1);
800 MEMORY_BARRIER_AFTER_ATOMIC();
802 sem_wait(&lr->queueSem);
803 atomic_add(&lr->queuers, -1);
806 static void freeLockRecord(monitorLockRecord *lr)
813 sem_post(&lr->queueSem);
816 static inline void handleWaiter(monitorLockRecord *mlr, monitorLockRecord *lr)
822 monitorLockRecord *monitorEnter(threadobject *t, java_objectheader *o)
825 monitorLockRecord *lr = o->monitorPtr;
827 monitorLockRecord *nlr, *mlr = allocLockRecordSimple(t);
833 handleWaiter(mlr, lr);
837 if (lr->ownerThread != t)
839 MEMORY_BARRIER_BEFORE_ATOMIC();
840 nlr = (void*) compare_and_swap((long*) &o->monitorPtr, (long) lr, (long) mlr);
843 if (mlr == lr || lr->o != o) {
844 handleWaiter(mlr, lr);
848 queueOnLockRecord(lr, o);
849 handleWaiter(mlr, lr);
853 recycleLockRecord(t, mlr);
854 queueOnLockRecord(nlr, o);
856 if (lr->ownerThread == t) {
860 queueOnLockRecord(lr, o);
865 static void wakeWaiters(monitorLockRecord *lr)
870 sem_post(&lr->queueSem);
875 #define GRAB_LR(lr,t) \
876 if (lr->ownerThread != t) { \
880 #define CHECK_MONITORSTATE(lr,t,mo,a) \
881 if (lr->o != mo || lr->ownerThread != t) { \
882 *exceptionptr = new_exception(string_java_lang_IllegalMonitorStateException); \
886 bool monitorExit(threadobject *t, java_objectheader *o)
888 monitorLockRecord *lr = o->monitorPtr;
890 CHECK_MONITORSTATE(lr, t, o, return false);
891 if (lr->lockCount > 1) {
896 monitorLockRecord *wlr = lr->waiter;
897 if (o->monitorPtr != lr ||
898 (void*) compare_and_swap((long*) &o->monitorPtr, (long) lr, (long) wlr) != lr)
900 monitorLockRecord *nlr = o->monitorPtr;
902 STORE_ORDER_BARRIER();
908 recycleLockRecord(t, lr);
912 static void removeFromWaiters(monitorLockRecord *lr, monitorLockRecord *wlr)
915 if (lr->waiter == wlr) {
916 lr->waiter = wlr->waiter;
923 bool waitWithTimeout(threadobject *t, monitorLockRecord *lr, struct timespec *wakeupTime)
927 pthread_mutex_lock(&lr->waitLock);
929 if (wakeupTime->tv_sec || wakeupTime->tv_nsec)
930 pthread_cond_timedwait(&lr->waitCond, &lr->waitLock, wakeupTime);
932 pthread_cond_wait(&lr->waitCond, &lr->waitLock);
933 wasinterrupted = t->waiting == NULL;
935 pthread_mutex_unlock(&lr->waitLock);
936 return wasinterrupted;
939 static void calcAbsoluteTime(struct timespec *tm, s8 millis, s4 nanos)
941 if (millis || nanos) {
944 gettimeofday(&tv, NULL);
945 tv.tv_sec += millis / 1000;
947 nsec = tv.tv_usec * 1000 + (s4) millis * 1000000 + nanos;
948 tm->tv_sec = tv.tv_sec + nsec / 1000000000;
949 tm->tv_nsec = nsec % 1000000000;
956 void monitorWait(threadobject *t, java_objectheader *o, s8 millis, s4 nanos)
959 struct timespec wakeupTime;
960 monitorLockRecord *mlr, *lr = o->monitorPtr;
962 CHECK_MONITORSTATE(lr, t, o, return);
964 calcAbsoluteTime(&wakeupTime, millis, nanos);
967 wakeWaiters(lr->waiter);
969 STORE_ORDER_BARRIER();
971 wasinterrupted = waitWithTimeout(t, lr, &wakeupTime);
972 mlr = monitorEnter(t, o);
973 removeFromWaiters(mlr, lr);
974 mlr->lockCount = lr->lockCount;
978 recycleLockRecord(t, lr);
981 *exceptionptr = new_exception(string_java_lang_InterruptedException);
984 static void notifyOneOrAll(threadobject *t, java_objectheader *o, bool one)
986 monitorLockRecord *lr = o->monitorPtr;
988 CHECK_MONITORSTATE(lr, t, o, return);
990 monitorLockRecord *wlr = lr->waiter;
993 pthread_cond_signal(&wlr->waitCond);
998 bool threadHoldsLock(threadobject *t, java_objectheader *o)
1000 monitorLockRecord *lr = o->monitorPtr;
1002 return lr->o == o && lr->ownerThread == t;
1005 void interruptThread(java_lang_VMThread *thread)
1007 threadobject *t = (threadobject*) thread;
1009 monitorLockRecord *lr = t->waiting;
1011 pthread_mutex_lock(&lr->waitLock);
1012 if (t->waiting == lr) {
1014 pthread_cond_signal(&lr->waitCond);
1016 pthread_mutex_unlock(&lr->waitLock);
1023 bool interruptedThread()
1025 threadobject *t = (threadobject*) THREADOBJECT;
1026 long intr = t->interrupted;
1031 bool isInterruptedThread(java_lang_VMThread *thread)
1033 threadobject *t = (threadobject*) thread;
1034 return t->interrupted;
1037 void sleepThread(s8 millis, s4 nanos)
1039 bool wasinterrupted;
1040 threadobject *t = (threadobject*) THREADOBJECT;
1041 monitorLockRecord *lr;
1042 struct timespec wakeupTime;
1043 calcAbsoluteTime(&wakeupTime, millis, nanos);
1045 lr = allocLockRecordSimple(t);
1046 wasinterrupted = waitWithTimeout(t, lr, &wakeupTime);
1047 recycleLockRecord(t, lr);
1050 *exceptionptr = new_exception(string_java_lang_InterruptedException);
1058 void setPriorityThread(thread *t, s4 priority)
1060 nativethread *info = &((threadobject*) t->vmThread)->info;
1061 setPriority(info->tid, priority);
1064 void wait_cond_for_object(java_objectheader *o, s8 time, s4 nanos)
1066 threadobject *t = (threadobject*) THREADOBJECT;
1067 monitorWait(t, o, time, nanos);
1070 void signal_cond_for_object(java_objectheader *o)
1072 threadobject *t = (threadobject*) THREADOBJECT;
1073 notifyOneOrAll(t, o, true);
1076 void broadcast_cond_for_object(java_objectheader *o)
1078 threadobject *t = (threadobject*) THREADOBJECT;
1079 notifyOneOrAll(t, o, false);
1086 * These are local overrides for various environment variables in Emacs.
1087 * Please do not remove this and leave it at the end of the file, where
1088 * Emacs will automagically detect them.
1089 * ---------------------------------------------------------------------
1092 * indent-tabs-mode: t