diff options
author | membar <membar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-19 08:28:43 +0000 |
---|---|---|
committer | membar <membar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-19 08:28:43 +0000 |
commit | 843607dfb47b51137eddb808427bd8627e89dd91 (patch) | |
tree | d3850b3d1b7ded7bcbfb6b163fc0d2d5a78e5a7b /libjava/include | |
parent | 03caada8b6198e8429cfe14112fc0bea1de97b96 (diff) | |
download | gcc-843607dfb47b51137eddb808427bd8627e89dd91.tar.gz |
* win32-threads.cc: (ensure_interrupt_event_initialized) New
function for lazy initialization of an auto-reset event.
(_Jv_CondWait) Added thread interrupt support.
(_Jv_ThreadInitData) Added initialization of interrupt support
members.
(_Jv_ThreadDestroyData) Added cleanup of interrupt support members.
(_Jv_ThreadStart) Removed unused code.
(_Jv_Win32GetInterruptEvent) New method for returning interrupt event
to an external caller.
(_Jv_ThreadInterrupt) Implemented.
* include/win32-threads.h: (_Jv_Thread_t) Added a Win32 auto-reset
event for interrupt support as well as a mutex which regulates
access to this.
(_Jv_Win32GetInterruptEvent) Declared new method for returning interrupt
event to an external caller.
* java/lang/natWin32Process.cc: (cleanup) Close handle to spawned
process.
(waitFor) Added interrupt support.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71562 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/include')
-rw-r--r-- | libjava/include/win32-threads.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libjava/include/win32-threads.h b/libjava/include/win32-threads.h index 5e40ae24b87..ed5eb0047e0 100644 --- a/libjava/include/win32-threads.h +++ b/libjava/include/win32-threads.h @@ -50,6 +50,14 @@ typedef struct { int flags; // Flags are defined in implementation. HANDLE handle; // Actual handle to the thread + + // Protects access to the thread's interrupt_flag and + // interrupt_event variables within this module. + CRITICAL_SECTION interrupt_mutex; + + // A Win32 auto-reset event for thread interruption + HANDLE interrupt_event; + java::lang::Thread *thread_obj; } _Jv_Thread_t; @@ -150,6 +158,24 @@ void _Jv_ThreadStart (java::lang::Thread *thread, _Jv_Thread_t *data, void _Jv_ThreadWait (void); void _Jv_ThreadInterrupt (_Jv_Thread_t *data); +// +// Thread interruption support +// + +// Gets the auto-reset event for the current thread which is +// signalled by _Jv_ThreadInterrupt. The caller can wait on this +// event in addition to other waitable objects. +// +// NOTE: After waiting on this event with WaitForMultipleObjects, +// you should ALWAYS use the return value of WaitForMultipleObjects +// to test whether this event was signalled and whether thread +// interruption has occurred. You should do this instead of checking +// the thread's interrupted_flag, because someone could have reset +// this flag in the interval of time between the return of +// WaitForMultipleObjects and the time you query interrupted_flag. +// See java/lang/natWin32Process.cc (waitFor) for an example. +HANDLE _Jv_Win32GetInterruptEvent (void); + // Remove defines from <windows.h> that conflict with various things in libgcj code #undef TRUE |