source: trunk/src/gcc/libjava/include/no-threads.h@ 607

Last change on this file since 607 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1// -*- c++ -*-
2// no-threads.h - Defines for using no threads.
3
4/* Copyright (C) 1998, 1999 Free Software Foundation
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;
28typedef int _Jv_Thread_t;
29typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
30
31
32//
33// Condition variables.
34//
35
36inline void
37_Jv_CondInit (_Jv_ConditionVariable_t *)
38{
39}
40
41// Waiting is ok provided there is a timeout. Otherwise we will just
42// wait forever.
43inline int
44_Jv_CondWait (_Jv_ConditionVariable_t *, _Jv_Mutex_t *,
45 jlong millis, jint nanos)
46{
47 if (millis == 0 && nanos == 0)
48 JvFail ("_Jv_CondWait without timeout");
49
50#ifdef HAVE_SLEEP
51 int seconds = millis / 1000;
52 if (seconds > 0)
53 sleep (seconds);
54#endif
55
56 return 0;
57}
58
59inline int
60_Jv_CondNotify (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
61{
62 // It is ok to notify -- it just has no effect.
63 return 0;
64}
65
66inline int
67_Jv_CondNotifyAll (_Jv_ConditionVariable_t *, _Jv_Mutex_t *)
68{
69 // It is ok to notify -- it just has no effect.
70 return 0;