2 // no-threads.h - Defines for using no threads.
4 /* Copyright (C) 1998, 1999 Free Software Foundation
6 This file is part of libgcj.
8 This software is copyrighted work licensed under the terms of the
9 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
12 #ifndef __JV_NO_THREADS__
13 #define __JV_NO_THREADS__
26 typedef int _Jv_ConditionVariable_t;
27 typedef int _Jv_Mutex_t;
28 typedef int _Jv_Thread_t;
29 typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
33 // Condition variables.
37 _Jv_CondInit (_Jv_ConditionVariable_t *)
41 // Waiting is ok provided there is a timeout. Otherwise we will just
44 _Jv_CondWait (_Jv_ConditionVariable_t *, _Jv_Mutex_t *,
45 jlong millis, jint nanos)
47 if (millis == 0 && nanos == 0)
48 JvFail ("_Jv_CondWait without timeout");
51 int seconds = millis / 1000;
60 _Jv_CondNotify (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
62 // It is ok to notify -- it just has no effect.
67 _Jv_CondNotifyAll (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
69 // It is ok to notify -- it just has no effect.
79 _Jv_MutexInit (_Jv_Mutex_t *)
84 _Jv_MutexLock (_Jv_Mutex_t *)
90 _Jv_MutexUnlock (_Jv_Mutex_t *)
97 // Thread creation and manipulation.
101 _Jv_InitThreads (void)
105 inline _Jv_Thread_t *
106 _Jv_ThreadInitData (java::lang::Thread *)
112 _Jv_ThreadDestroyData (_Jv_Thread_t *data)
116 inline java::lang::Thread *
117 _Jv_ThreadCurrent (void)
119 extern java::lang::Thread *_Jv_OnlyThread;
120 return _Jv_OnlyThread;
124 _Jv_ThreadYield (void)
129 _Jv_ThreadSetPriority (_Jv_Thread_t *, jint)
133 void _Jv_ThreadStart (java::lang::Thread *, _Jv_Thread_t *,
134 _Jv_ThreadStartFunc *meth);
137 _Jv_ThreadWait (void)
142 _Jv_ThreadInterrupt (_Jv_Thread_t *)
146 #endif /* __JV_NO_THREADS__ */