source: trunk/src/gcc/libjava/win32-threads.cc@ 3

Last change on this file since 3 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: 7.1 KB
Line 
1// win32-threads.cc - interface between libjava and Win32 threads.
2
3/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11#include <config.h>
12
13// If we're using the Boehm GC, then we need to override some of the
14// thread primitives. This is fairly gross.
15#ifdef HAVE_BOEHM_GC
16extern "C"
17{
18#include <gc.h>
19// <windows.h> #define's STRICT, which conflicts with Modifier.h
20#undef STRICT
21};
22#endif /* HAVE_BOEHM_GC */
23
24#include <gcj/cni.h>
25#include <jvm.h>
26#include <java/lang/Thread.h>
27#include <java/lang/System.h>
28
29#include <errno.h>
30
31#ifndef ETIMEDOUT
32#define ETIMEDOUT 116
33#endif
34
35// This is used to implement thread startup.
36struct starter
37{
38 _Jv_ThreadStartFunc *method;
39 _Jv_Thread_t *data;
40};
41
42// Controls access to the variable below
43static HANDLE daemon_mutex;
44static HANDLE daemon_cond;
45// Number of non-daemon threads - _Jv_ThreadWait returns when this is 0
46static int non_daemon_count;
47
48// TLS key get Java object representing the thread
49DWORD _Jv_ThreadKey;
50// TLS key to get _Jv_Thread_t* representing the thread
51DWORD _Jv_ThreadDataKey;
52
53//
54// These are the flags that can appear in _Jv_Thread_t.
55//
56
57// Thread started.
58#define FLAG_START 0x01
59// Thread is daemon.
60#define FLAG_DAEMON 0x02