Commit Graph

17 Commits

Author SHA1 Message Date
Mohan Embar d1789dc25a * include/win32-threads.h: Added #undef OUT.
From-SVN: r122227
2007-02-22 14:13:34 +00:00
Tom Tromey 97b8365caf Merged gcj-eclipse branch to trunk.
From-SVN: r120621
2007-01-09 19:58:05 +00:00
Mohan Embar 68ea48ea13 win32-threads.h (_Jv_Thread_t): Explicitly name the struct.
2006-07-23  Mohan Embar  <gnustuff@thisiscool.com>

	* include/win32-threads.h (_Jv_Thread_t): Explicitly
	name the struct.

From-SVN: r115701
2006-07-24 00:22:25 +00:00
Keith Seitz 303f32ccd7 boehm.cc (_Jv_SuspendThread): Don't ifdef the function declaration, just the contents.
* boehm.cc (_Jv_SuspendThread): Don't ifdef the function declaration,
        just the contents.
        (_Jv_ResumeThread): Likewise.
        * posix-threads.cc: Revert 2006-06-19 _Jv_ThreadDebugSuspend,
        _Jv_ThreadDebugResume, _Jv_ThreadDebugSuspendCount patch. Moving
        to JVMTI instead.
        * include/posix-threads.h: Likewise.
        * win32-threads.cc: Likewise.
        * include/win32-threads.h: Likewise.
        * jvmti.cc (_Jv_JVMTI_SuspentThread): New function.
        (_Jv_JVMTI_ResumeThread): New function.
        (_Jv_JVMTI_Interface): Define SuspendThread and ResumeThread.

From-SVN: r115655
2006-07-21 23:45:03 +00:00
Keith Seitz 49799ad34f posix-threads.h: Fix coding style aberrations from 2006-06-19 check-in.
* include/posix-threads.h: Fix coding style aberrations from
        2006-06-19 check-in.
        * posix-threads.cc (_Jv_ThreadDebugSuspend): Ditto.
        * include/win32-threads.h (_Jv_ThreadDebugSuspend): Ditto.
        * win32-threads.cc (_Jv_ThreadDebugSuspend): Ditto.

From-SVN: r115020
2006-06-26 17:59:42 +00:00
Bryce McKinlay 86cede157a win32-threads.h (_Jv_ThreadDesc_t): New typedef.
2006-06-21  Bryce McKinlay  <mckinlay@redhat.com>

        * include/win32-threads.h (_Jv_ThreadDesc_t): New typedef.
        (_Jv_GetPlatformThreadID): New function.
        * include/posix-threads.h (_Jv_ThreadDesc_t): New typedef.
        (_Jv_GetPlatformThreadID): New function.

From-SVN: r114854
2006-06-21 17:27:14 +01:00
Keith Seitz 4307d0dbf9 posix-threads.h (_Jv_ThreadDebugSuspend): Declare.
* include/posix-threads.h (_Jv_ThreadDebugSuspend): Declare.
        (_Jv_ThreadDebugResume): Declare.
        (_Jv_ThreadDebugSuspendCount): Declare.
        * posix-threads.cc (_Jv_ThreadDebugSuspend): New function.
        (_Jv_ThreadDebugSuspendCount): New function.
        (_Jv_ThreadDebugResume): New function.

        * include/win32-threads.h (_Jv_ThreadDebugSuspend): Declare.
        (_Jv_ThreadDebugResume): Declare.
        (_Jv_ThreadDebugSuspendCount): Declare.
        * win32-threads.cc (_Jv_ThreadDebugSuspend): New function.
        (_Jv_ThreadDebugSuspendCount): New function.
        (_Jv_ThreadDebugResume): New function.

From-SVN: r114769
2006-06-19 14:10:02 +00:00
Mohan Embar a0be84dd8c re PR libgcj/14751 ([win32] thread creation leaks system handle resources)
PR libgcj/14751
	* win32-threads.cc (_Jv_ThreadInitData): Zero out thread
	handle in newly-allocated _Jv_Thread_t.
	(_Jv_ThreadDestroyData): Close thread handle.
	(_Jv_ThreadStart): Remove obsolete comment.
	Store handle of newly-created thread in _Jv_Thread_t.
	* include/win32-threads.h: #define WIN32_LEAN_AND_MEAN
	before including <windows.h>
	#define _Jv_HaveCondDestroy

From-SVN: r87362
2004-09-11 19:13:51 +00:00
Jerry Quinn 16a10fb6fc posix-threads.cc (_Jv_CondNotify,_Jv_CondNotifyAll): Rename _Jv_PthreadCheckMonitor to _Jv_MutexCheckMonitor.
2003-10-21  Jerry Quinn  <jlquinn@optonline.net>

        * posix-threads.cc (_Jv_CondNotify,_Jv_CondNotifyAll): Rename
        _Jv_PthreadCheckMonitor to _Jv_MutexCheckMonitor.
	* include/no-threads.h (_Jv_MutexCheckMonitor): New.
	* include/posix-threads.h (_Jv_MutexCheckMonitor): Rename from
        _Jv_PthreadCheckMonitor.  Simplify code.
	(_Jv_MutexUnlock): Use _Jv_MutexCheckMonitor.
	* include/win32-threads.h (_Jv_MutexCheckMonitor): New.
	* java/lang/Object.h (_Jv_ObjectCheckMonitor): Declare.
	* java/lang/Thread.java (holdsLock): New.
	* java/lang/natObject.cc (_Jv_ObjectCheckMonitor): New, with and
        without JV_HASH_SYNCHRONIZATION.
	* java/lang/natThread.cc (java::lang::Thread::holdsLock): New.

From-SVN: r72741
2003-10-21 04:46:19 +00:00
Mohan Embar b90e0e3cdb 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
2003-09-19 08:28:43 +00:00
Ranjit Mathew 65b8e87409 re PR java/9254 (java::lang::Object::wait(), threads-win32.cc returns wrong return codes)
2003-01-28  Ranjit Mathew  <rmathew@hotmail.com>

	Fixes PR java/9254:
	* include/win32-threads.h (_Jv_Mutex_t): Convert to a struct
	additionally containing id of the owner thread as well as
	the number of nested times the thread has acquired the mutex.
	(_Jv_MutexInit): Initialise owner thread id and refcount to 0.
	(_Jv_MutexDestroy): Reset owner thread id and refcount to 0.
	(_Jv_MutexUnlock): Check if really the owner thread, reset
	owner thread id to 0 before leaving, if leaving for the last
	time.
	(_Jv_MutexLock): Set owner thread id in the mutex and increment
	refcount.
	(_Jv_ThreadYield): Yield using a call to Sleep(0).
	* win32-threads.cc (_Jv_CondWait): Check if really owner of
	the passed mutex.
	Pass handle of the broadcast event, instead of a pointer to it
	in Win32 ResetEvent( ) call.
	Remove incorrect return values.
	(_Jv_CondDestroy): Close both event handles and delete
	critical section.
	(_Jv_CondNotify): Check if really the owner thread.
	(_Jv_CondNotifyAll): Check if really the owner thread.
	(_Jv_InitThreads): Change daemon_cond to a manual-reset event.
	(really_start): Use SetEvent( ) to signal daemon_cond.
	(_Jv_ThreadWait): Remove SignalObjectAndWait( ) and use
	WaitForSingleObject( ) instead to wait for daemon_cond to be
	signalled.

From-SVN: r62033
2003-01-28 22:23:36 +00:00
Adam Megacz e2a450f6e8 aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added
2002-10-20  Adam Megacz <adam@xwt.org>

        * aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added
        * configure.in: enabled hash sync on Win32
        * include/win32-threads.h (_Jv_ThreadId_t): added.
        * java/lang/natObject.cc (_Jv_MonitorEnter, _Jv_MonitorExit,
        heavy_lock_obj_finalization_proc, wait, notify, notifyAll):
        removed some posix-isms, use Thread::sleep() instead of usleep,
        added code to clear bottom three bits if platform has a broken
        linker.  * include/win32-threads.h (_Jv_ThreadId_t): added.

From-SVN: r58344
2002-10-21 01:50:14 +00:00
Adam Megacz 8627cc158d win32-threads.h (_Jv_ConditionVariable_t): Now a struct, to enable safer wait() algorithm.
2002-02-01  Adam Megacz <adam@xwt.org>

        * include/win32-threads.h (_Jv_ConditionVariable_t): Now a struct, to
	enable safer wait() algorithm.
	(_Jv_CondWait, _Jv_CondInit, _Jv_CondDestroy, _Jv_CondNotify,
	_Jv_CondNotifyAll): Implementations moved to win32-threads.cc.
	(_Jv_MutexInit, _Jv_HaveMutexDestroy, _Jv_MutexUnlock,
	_Jv_MutexLock, _Jv_ThreadYield): Reimplement using CRITICAL_SECTIONs
	instead of mutex.
	(_Jv_ThreadYield): Don't call Sleep(), because it crashes win98.

From-SVN: r49427
2002-02-02 04:27:34 +00:00
Per Bothner c93d7fae7b Implement invocation interface; don't create new thread for main.
From-SVN: r42428
2001-05-21 23:47:48 -07:00
Bryce McKinlay e301621d19 For boehm-gc:
* configure.in: Rename THREADLIB to THREADLIBS.
	* Makefile.am (LINK): Add $(THREADLIBS) to libtool command line. This
	ensures that we link the correct version of the linuxthreads semaphore
	functions.
	* Makefile.in: Rebuilt.
	* configure: Rebuilt.

	* linux_thread.c (GC_thr_init, GC_suspend_handler): Add SIGABRT to the
	list of signals which are not blocked during suspend in the NO_SIGNALS
	case.

For libjava:
	* Makefile.am (libgcj_la_LIBADD): Add $(THREADLIBS). This ensures that
	the correct versions of various linuxthreads functions get linked.
	* Makefile.in: Rebuilt.
	* java/lang/natThread.cc (finalize_native): New static function. Call
	_Jv_ThreadDestroyData.
	(initialize_native): Register finalizer for "data".
	* include/posix-threads.h (_Jv_ThreadInitData): New simpler prototype.
	(_Jv_ThreadDestroyData): New prototype.
	* include/win32-threads.h: Ditto.
	* include/no-threads.h: Ditto.
	* posix-threads.cc (_Jv_ThreadInitData): Implement new prototype.
	(_Jv_ThreadDestroyData): New function. Free native thread "data" and
	move mutex and condition variable destroy code from:
	(really_start): ...here.
	(_Jv_ThreadStart): Set PTHREAD_CREATE_DETACHED.
	* win32-threads.cc (_Jv_ThreadInitData): Implement new prototype.
	(_Jv_ThreadDestroyData): Implemented.
	* nogc.cc (_Jv_AllocObject): Use "void *" not "ptr_t".
	(_Jv_AllocArray): Ditto.

From-SVN: r38557
2000-12-30 12:18:39 +00:00
Bryce McKinlay b834f1fa06 Makefile.in: New #defines and friends for Thread.h.
* Makefile.in: New #defines and friends for Thread.h.
        * posix-threads.cc: (struct starter): Remove `object'.
        (_Jv_CondWait): Use interruptable condition variables and new
        recursive mutexes. New return codes on interrupt or non-ownership
        of mutex.
        (_Jv_CondNotify): Ditto.
        (_Jv_CondNotifyAll): Ditto.
        (_Jv_ThreadInterrupt): Set thread interrupt flag directly. Interrupt
        the target thread by signaling its wait condition.
        (_Jv_ThreadInitData): Set `thread_obj' in the thread data struct,
        not the starter struct. Initialize wait_mutex and wait_cond.
        (_Jv_MutexLock): New recursive mutex implementation. Moved from
        posix-threads.h.
        (_Jv_MutexUnlock): Ditto.
        (really_start): Set info->data->thread from pthread_self() to work
        around a race condition. Destroy wait_mutex and wait_cond when run()
        returns.
        * java/lang/Thread.java: (isInterrupted_): Renamed to overloaded
        `isInterrupted(boolean)'. Clear interrupted flag if clear_flag is
        set.
        startable_flag: New private field.
        (Thread): Initialize `startable_flag'.
        (toString): Check for null thread group.
        * java/lang/natThread.cc: (struct natThread): New fields
        `join_mutex', `join_cond'. Removed fields `joiner', `next'.
        (class locker): Removed.
        (initialize_native): Initialize `join_cond' and `join_mutex'.
        (interrupt): Now just calls _Jv_ThreadInterrupt().
        (join): Simplified. Just wait on the target thread's join condition.
        (finish_): Remove join list code. Unset thread group. Signal
        potential joiners by notifying the dying threads join_cond.
        (start): Check for illegal restarts.
        * java/lang/natObject.cc: Check for return value of _Jv_CondWait and
        act appropriatly.
        * include/posix-threads.h: Remove all HAVE_RECURSIVE_MUTEX related
        #defines and #ifdefs.
        (struct _Jv_Thread_t): New fields `thread_obj', `wait_cond',
        `wait_mutex', `next'.
        (struct _Jv_ConditionVariable_t): Define as a struct instead of
        directly mapping to pthread_cond_t.
        (struct _Jv_Mutex_t): New recursive implementation.
        (_Jv_PthreadCheckMonitor): Reimplemented. Simple `owner' check.
        _Jv_HaveCondDestroy: Never define this for posix-threads.
        (_Jv_CondNotify): Remove inline implementation(s), prototype instead.
        (_Jv_CondNotifyAll): Ditto.
        (_Jv_MutexLock): Ditto.
        (_Jv_MutexUnlock): Ditto.
        (_Jv_MutexInit): Changed to reflect new mutex implementation.
        (_Jv_MutexDestroy): Ditto.
        (_Jv_CondDestroy): Removed.
        (_Jv_PthreadGetMutex): Removed.
        * include/win32-threads.h: (_Jv_CondNotify): Guess _JV_NOT_OWNER on an
        error. Add a FIXME about this.
        (_Jv_CondNotifyAll): Ditto.
        * win32-threads.cc: (_Jv_CondWait): Return 0 on a timeout. Guess
        _JV_NOT_OWNER on other errors. Add FIXME.

From-SVN: r32773
2000-03-28 03:22:24 +01:00
Tom Tromey 878885b411 [multiple changes]
2000-03-15  Tom Tromey  <tromey@cygnus.com>

	* java/io/natFileDescriptorWin32.cc (winerr): Now static.

	* prims.cc (win32_exception_handler): Reformatted.

	* include/win32-threads.h (_Jv_HaveCondDestroy): New define.
	(_Jv_HaveMutexDestroy): Likewise.

2000-03-15 Jon Beniston <jb7216@bristol.ac.uk>

	* java/io/natFileDescriptorWin32.cc: New file.
	* java/io/natFileWin32.cc: New file.
	* java/net/natInetAddress.cc: Added conditional inclusion of
	Windows / Winsock headers.
	* java/net/natPlainDatagramSocketImpl.cc: Added conditional
	inclusion of Windows / Winsock headers.
	* java/net/natPlainSocketImpl.cc: Added conditional inclusion of
	Windows / Winsock headers.
	* include/win32-signal.h: New file.
	* include/win32-threads.h: New file.
	* win32-threads.cc: New file.
	* exception.cc (win32_get_restart_frame): New function.
	* prims.cc (win32_exception_handler): New function.
	(main_init) Performs Winsock initialisation.
	(main_init) Installs exeception handler.

From-SVN: r32567
2000-03-15 22:03:19 +00:00