diff options
author | Mohan Embar <gnustuff@thisiscool.com> | 2003-09-19 08:28:43 +0000 |
---|---|---|
committer | Mohan Embar <membar@gcc.gnu.org> | 2003-09-19 08:28:43 +0000 |
commit | b90e0e3cdb60af9429f1acd99d9e30a65c03752d (patch) | |
tree | d3850b3d1b7ded7bcbfb6b163fc0d2d5a78e5a7b /libjava/include/win32-threads.h | |
parent | 65f070242b4206f88edf3c53000520f3f5c0224a (diff) | |
download | gcc-b90e0e3cdb60af9429f1acd99d9e30a65c03752d.zip gcc-b90e0e3cdb60af9429f1acd99d9e30a65c03752d.tar.gz gcc-b90e0e3cdb60af9429f1acd99d9e30a65c03752d.tar.bz2 |
win32-threads.cc: (ensure_interrupt_event_initialized) New function for lazy initialization of an...
* 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.
From-SVN: r71562
Diffstat (limited to 'libjava/include/win32-threads.h')
-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 5e40ae2..ed5eb00 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 |