2 // no-threads.h - Defines for using no threads.
4 /* Copyright (C) 1998, 1999, 2004, 2006 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 void _Jv_ThreadStartFunc (java::lang::Thread
*);
34 class _Jv_Thread_t
{ };
37 // Condition variables.
41 _Jv_CondInit (_Jv_ConditionVariable_t
*)
45 // Waiting is ok provided there is a timeout. Otherwise we will just
48 _Jv_CondWait (_Jv_ConditionVariable_t
*, _Jv_Mutex_t
*,
49 jlong millis
, jint nanos
)
51 if (millis
== 0 && nanos
== 0)
52 JvFail ("_Jv_CondWait without timeout");
55 int seconds
= millis
/ 1000;
64 _Jv_CondNotify (_Jv_ConditionVariable_t
*, _Jv_Mutex_t
*)
66 // It is ok to notify -- it just has no effect.
71 _Jv_CondNotifyAll (_Jv_ConditionVariable_t
*, _Jv_Mutex_t
*)
73 // It is ok to notify -- it just has no effect.
82 inline int _Jv_MutexCheckMonitor (_Jv_Mutex_t
*)
88 _Jv_MutexInit (_Jv_Mutex_t
*)
93 _Jv_MutexLock (_Jv_Mutex_t
*)
99 _Jv_MutexUnlock (_Jv_Mutex_t
*)
106 // Thread creation and manipulation.
110 _Jv_InitThreads (void)
115 _Jv_ThreadInitData (java::lang::Thread
*);
118 _Jv_ThreadDestroyData (_Jv_Thread_t
*)
122 inline java::lang::Thread
*
123 _Jv_ThreadCurrent (void)
125 extern java::lang::Thread
*_Jv_OnlyThread
;
126 return _Jv_OnlyThread
;
130 _Jv_ThreadYield (void)
135 _Jv_ThreadSetPriority (_Jv_Thread_t
*, jint
)
140 _Jv_ThreadRegister (_Jv_Thread_t
*)
145 _Jv_ThreadUnRegister (void)
149 void _Jv_ThreadStart (java::lang::Thread
*, _Jv_Thread_t
*,
150 _Jv_ThreadStartFunc
*meth
);
153 _Jv_ThreadWait (void)
158 _Jv_ThreadInterrupt (_Jv_Thread_t
*)
162 #endif /* __JV_NO_THREADS__ */