]> gcc.gnu.org Git - gcc.git/blame - libjava/include/no-threads.h
natThread.cc (finalize_native): Remove cast.
[gcc.git] / libjava / include / no-threads.h
CommitLineData
ee9dd372
TT
1// -*- c++ -*-
2// no-threads.h - Defines for using no threads.
3
006d133d 4/* Copyright (C) 1998, 1999, 2004, 2006 Free Software Foundation
ee9dd372
TT
5
6 This file is part of libgcj.
7
8This software is copyrighted work licensed under the terms of the
9Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
10details. */
11
12#ifndef __JV_NO_THREADS__
13#define __JV_NO_THREADS__
14
15#include "config.h"
16
17#include <stdlib.h>
18#ifdef HAVE_UNISTD_H
19#include <unistd.h>
20#endif
21
22//
23// Typedefs.
24//
25
26typedef int _Jv_ConditionVariable_t;
27typedef int _Jv_Mutex_t;
ee9dd372
TT
28typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
29
006d133d
AT
30//
31// Declarations
32//
33
34class _Jv_Thread_t { };
ee9dd372
TT
35
36//
37// Condition variables.
38//
39
40inline void
41_Jv_CondInit (_Jv_ConditionVariable_t *)
42{
43}
44
45// Waiting is ok provided there is a timeout. Otherwise we will just
46// wait forever.
47inline int
48_Jv_CondWait (_Jv_ConditionVariable_t *, _Jv_Mutex_t *,
49 jlong millis, jint nanos)
50{
51 if (millis == 0 && nanos == 0)
52 JvFail ("_Jv_CondWait without timeout");
53
54#ifdef HAVE_SLEEP
55 int seconds = millis / 1000;
56 if (seconds > 0)
57 sleep (seconds);
58#endif
59
60 return 0;
61}
62
63inline int
64_Jv_CondNotify (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
65{
66 // It is ok to notify -- it just has no effect.
67 return 0;
68}
69
70inline int
71_Jv_CondNotifyAll (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
72{
73 // It is ok to notify -- it just has no effect.
74 return 0;
75}
76
77
78//
79// Mutexes.
80//
81
7edc2bad 82inline int _Jv_MutexCheckMonitor (_Jv_Mutex_t *)
16a10fb6
JQ
83{
84 return 0;
85}
86
ee9dd372
TT
87inline void
88_Jv_MutexInit (_Jv_Mutex_t *)
89{
90}
91
92inline int
93_Jv_MutexLock (_Jv_Mutex_t *)
94{
95 return 0;
96}
97
98inline int
99_Jv_MutexUnlock (_Jv_Mutex_t *)
100{
101 return 0;
102}
103
104
105//
106// Thread creation and manipulation.
107//
108
109inline void
110_Jv_InitThreads (void)
111{
112}
113
c93d7fae
PB
114_Jv_Thread_t *
115_Jv_ThreadInitData (java::lang::Thread *);
e301621d 116
ee9dd372 117inline void
7edc2bad 118_Jv_ThreadDestroyData (_Jv_Thread_t *)
ee9dd372 119{
ee9dd372
TT
120}
121
122inline java::lang::Thread *
123_Jv_ThreadCurrent (void)
124{
125 extern java::lang::Thread *_Jv_OnlyThread;
126 return _Jv_OnlyThread;
127}
128
129inline void
130_Jv_ThreadYield (void)
131{
132}
133
134inline void
135_Jv_ThreadSetPriority (_Jv_Thread_t *, jint)
136{
137}
138
c93d7fae 139inline void
7edc2bad 140_Jv_ThreadRegister (_Jv_Thread_t *)
c93d7fae
PB
141{
142}
143
144inline void
145_Jv_ThreadUnRegister (void)
146{
147}
148
ee9dd372
TT
149void _Jv_ThreadStart (java::lang::Thread *, _Jv_Thread_t *,
150 _Jv_ThreadStartFunc *meth);
151
152inline void
153_Jv_ThreadWait (void)
154{
155}
156
157inline void
158_Jv_ThreadInterrupt (_Jv_Thread_t *)
159{
160}
161
162#endif /* __JV_NO_THREADS__ */
This page took 0.619034 seconds and 5 git commands to generate.