re PR libgcj/30606 (natVMURLConnection.cc:21: error: 'magic_t' does not name a typet...
[gcc.git] / libjava / include / win32-threads.h
index 27f7b65bf5aefcfb2beb8ebc8b8b07df813f4cdb..442149c3cd8b89e17dabe3719f3c2040fdc9d700 100644 (file)
@@ -47,7 +47,7 @@ typedef struct
 
 } _Jv_Mutex_t;
 
-typedef struct
+typedef struct _Jv_Thread_t
 {
   int flags;            // Flags are defined in implementation.
   HANDLE handle;        // Actual handle to the thread
@@ -193,19 +193,27 @@ void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
 // See java/lang/natWin32Process.cc (waitFor) for an example.
 HANDLE _Jv_Win32GetInterruptEvent (void);
 
-// Increases a thread's suspend count. If the thread's previous
-// suspend count was zero, i.e., it is not suspended, this function
-// will suspend the thread. This function may be used to suspend
-// any thread from any other thread (or suspend itself).
-void _Jv_ThreadDebugSuspend (_Jv_Thread_t *data);
+// park() / unpark() support
 
-// Decreases a thread's suspend count. If the thread's new thread
-// count is zero, the thread is resumed. This function may be used
-// by any thread to resume any other thread.
-void _Jv_ThreadDebugResume (_Jv_Thread_t *data);
+struct ParkHelper
+{
+  // We use LONG instead of obj_addr_t to avoid pulling in locks.h,
+  // which depends on size_t, ...
+  volatile LONG permit;
 
-// Get the suspend count for a thread
-jint _Jv_ThreadDebugSuspendCount (_Jv_Thread_t *data);
+  // The critical section is used for lazy initialization of our event
+  CRITICAL_SECTION cs;
+  HANDLE event;
+  
+  void init ();
+  void deactivate ();
+  void destroy ();
+  void park (jboolean isAbsolute, jlong time);
+  void unpark ();
+  
+private:
+  void init_event();
+};
 
 // Remove defines from <windows.h> that conflict with various things in libgcj code
 
@@ -218,5 +226,6 @@ jint _Jv_ThreadDebugSuspendCount (_Jv_Thread_t *data);
 #undef interface
 #undef STRICT
 #undef VOID
+#undef TEXT
 
 #endif /* __JV_WIN32_THREADS__ */