Commit Graph

49 Commits

Author SHA1 Message Date
Ben Elliston 5d6b1baca0 posix-threads.cc (ParkHelper::unpark): Do not initialise result, but assign it instead.
* posix-threads.cc (ParkHelper::unpark): Do not initialise result,
	but assign it instead. Eliminates an unused variable warning when
	the result == 0 assertion is disabled.

From-SVN: r154670
2009-11-26 21:06:35 +11:00
Andrew Haley 6bab028494 posix-threads.cc (park): Rewrite code to handle time.
2009-11-17  Andrew Haley  <aph@redhat.com>

	* posix-threads.cc (park): Rewrite code to handle time.
	Move mutex lock before the call to compare_and_swap to avoid a
	race condition.
	Add some assertions.
	(unpark): Add an assertion.
	(init): Move here from posix-threads.h.
	* include/posix-threads.h (destroy): removed.

From-SVN: r154265
2009-11-17 18:05:00 +00:00
David Daney 8c0dbf3490 re PR libgcj/29324 (add wait handling hook)
PR libgcj/29324
	* include/posix-threads.h (_Jv_BlockSigchld): Declare.
	(_Jv_UnBlockSigchld): Same.
	* posix-threads.cc: Include posix-threads.h.
	(block_sigchld) Rename to...
	(_Jv_BlockSigchld) ... this.
	(_Jv_UnBlockSigchld): New function.
	(_Jv_InitThreads): Call _Jv_BlockSigchld in place of block_sigchld.
	(_Jv_ThreadStart): Same.
	* java/lang/PosixProcess$ProcessManager.h: Regenerate.
	* java/lang/PosixProcess.java: Clean up imports.
	(ProcessManager): Make final.
	(ProcessManager.queue): Genericise and make private.
	(ProcessManager.pidToProcess): Remove.
	(ProcessManager.liveProcesses): New field.
	(ProcessManager.reaperPID): Remove.
	(ProcessManager.nativeData): New field.
	(ProcessManager.removeProcessFromMap): Remove.
	(ProcessManager.addProcessToMap):Remove.
	(ProcessManager.addToLiveProcesses): New method.
	(ProcessManager.run): Rewritten.
	(ProcessManager.reap): Change method signature,
	(getErrorStream): Correct formatting.
	(getInputStream): Same.
	(spawn): Add process to liveProcesses list.
	(pid): Make package private.
	* java/lang/PosixProcess.h: Regenerate.
	* java/lang/natPosixProcess.cc: Include posix.h and posix-threads.h.
	Add useing namespace java::lang.
	(ProcessManagerInternal): New struct.
	(sigchld_handler): Rewritten.
	(init): Rewritten.
	(waitForSignal): Same.
	(reap): Same.
	(signalReaper): Same.
	(nativeDestroy): Call kill as ::kill.
	(nativeSpawn): Correct formatting.
	* classpath/lib/java/lang/PosixProcess$EOFInputStream.class: Regenerate.
	* classpath/lib/java/lang/PosixProcess.class: Same.
	* classpath/lib/java/lang/PosixProcess$ProcessManager.class: Same.

From-SVN: r124638
2007-05-12 17:37:55 +00:00
Tom Tromey 97b8365caf Merged gcj-eclipse branch to trunk.
From-SVN: r120621
2007-01-09 19:58:05 +00:00
Andreas Schwab f7ad6748b9 * posix-threads.cc: Include "posix.h".
From-SVN: r116943
2006-09-14 09:55:47 +00:00
Geoffrey Keating 06fcf75439 posix.cc (_Jv_platform_nanotime): Return nanoseconds, not microseconds; use gettimeofday when available.
* posix.cc (_Jv_platform_nanotime): Return nanoseconds, not
	microseconds; use gettimeofday when available.
	* posix-threads.cc (_Jv_CondWait): Improve accuracy and range of
	timeout calculation.
	* testsuite/libjava.lang/Thread_Sleep_2.java: New.
	* testsuite/libjava.lang/Thread_Sleep_2.out: New.
	* testsuite/libjava.lang/Thread_Sleep_2.xfail: New.

From-SVN: r116941
2006-09-14 01:17:31 +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
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
Krister Walfridsson 1916e588f3 posix-threads.cc (_Jv_InitThreads): #ifdef PTHREAD_STACK_MIN
2006-01-04  Krister Walfridsson  <cato@df.lth.se>

	* posix-threads.cc (_Jv_InitThreads): #ifdef PTHREAD_STACK_MIN

From-SVN: r109350
2006-01-04 21:11:51 +00:00
Andrew Haley ca146b8fdf re PR libgcj/25016 (Integer overflow in _Jv_CondWait)
2005-11-25  Andrew Haley  <aph@redhat.com>

        PR libgcj/25016
        * posix-threads.cc (_Jv_CondWait): Rewrite calculation of the
        struct timespec we pass to pthread_cond_timedwait.

From-SVN: r107509
2005-11-25 16:18:17 +00:00
Bryce McKinlay 11922361e4 Implement -Xss.
* include/jvm.h (gcj::stack_size): Declare.
        (_Jv_StackSize): Declare.
        * posix-threads.cc (_Jv_InitThreads): Validate gcj::stack_size.
        (_Jv_ThreadStart): Set stack size if specified.
        * prims.cc (gcj::stack_size): Define.
        (parse_memory_size): Renamed from parse_heap_size.
        (_Jv_SetStackSize): Parse stack size argument and set
        gcj::stack_size.

From-SVN: r107132
2005-11-17 20:25:57 +00:00
Andrew Haley 5e180a3f54 posix-threads.cc (_Jv_ThreadSetPriority): Use SCHED_OTHER (regular...
2005-07-08  Andrew Haley  <aph@redhat.com>

        * posix-threads.cc (_Jv_ThreadSetPriority): Use SCHED_OTHER
        (regular, non-realtime scheduling), not SCHED_RR (realtime,
        round-robin).

From-SVN: r101769
2005-07-08 14:04:22 +00:00
David Daney 7e9534bc54 prims.cc (_Jv_CreateJavaVM): Add comment about initialization order.
2005-02-15  David Daney <ddaney@avtrex.com>
            Bryce McKinlay  <mckinlay@redhat.com>

	* prims.cc (_Jv_CreateJavaVM): Add comment about initialization order.
	* posix-threads.cc (_Jv_InitThreads): Call block_sigchld() here to
	ensure that GC threads inherit the new signal mask.
	(block_sigchld): Call JvFail rather than throwing exception if
	pthread_sigmask() fails.

Co-Authored-By: Bryce McKinlay <mckinlay@redhat.com>

From-SVN: r95095
2005-02-16 04:16:06 +00:00
David Daney c58f29001d re PR libgcj/11801 (Problems with Process.waitFor() and exitValue())
2004-08-12  David Daney  <ddaney@avtrex.com>

	PR libgcj/11801
	* java/lang/PosixProcess.java: Rewrote.
	* java/lang/natPosixProcess.cc: Rewrote.
	* java/lang/Runtime.java (execInternal): Declare throws IOException.
	* gcj/javaprims.h (ConcreteProcess$ProcessManager): Declare.
	* posix-threads.cc (block_sigchld) New function.
	(_Jv_ThreadRegister) Use it.
	(_Jv_ThreadStart) Use it.
	* configure.in (PLATFORM_INNER_NAT_HDRS): New AC_SUBST() used in...
	* Makefile.am: ... to specify extra native headers.
	* configure: Regenerated.
	* include/config.h: Regenerated.
	* Makefile.in: Regenerated.
	* gcj/Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.

From-SVN: r85880
2004-08-12 16:20:11 +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
Jason Thorpe 66c4e25802 posix-threads.cc: Include <unistd.h> if HAVE_UNISTD_H is defined.
* posix-threads.cc: Include <unistd.h> if HAVE_UNISTD_H is defined.
(_Jv_ThreadSetPriority): Test for _POSIX_THREAD_PRIORITY_SCHEDULING.

From-SVN: r63647
2003-03-02 01:24:40 +00:00
Bryce McKinlay 1de21d0eac posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use write_barrier, not release_set.
* posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use write_barrier,
	not release_set.
	* sysdep/powerpc/locks.h (write_barrier): New function.
	* sysdep/i386/locks.h (write_barrier): New function.

From-SVN: r51101
2002-03-21 00:26:46 +00:00
Bryce McKinlay 4559716751 Hashtable synchronization for PowerPC.
libjava:
	Hashtable synchronization for PowerPC.
	* configure.in: Define SLOW_PTHREAD_SELF if configure.host set
	slow_pthread_self. Set up symlink for sysdeps directory.
	* configure: Rebuild.
	* configure.host: Document more shell variables. Set sysdeps_dir
	for most platforms. Set slow_pthread_self for i686. Set
	enable_hash_synchronization_default and slow_pthread_self for PowerPC.
	* posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use release_set so
	that memory barrier is emitted where required.
	* prims.cc: 64-bit align static primitive class instances.
	* include/posix-threads.h (_Jv_ThreadSelf for SLOW_PTHREAD_SELF): Add
	read_barrier() to enforce ordering of reads.
	* sysdep/powerpc/locks.h: New file. Implementation of synchronization
	primitives for PowerPC.
	* sysdep/i386/locks.h: New file. Synchronization primitives for i386
	moved from natObject.cc.
	* sysdep/alpha/locks.h: Likewise.
	* sysdep/ia64/locks.h: Likewise.
	* sysdep/generic/locks.h: Likewise.
	* java/lang/natObject.cc: Move thread synchronization primitives to
	system-dependent headers.
gcc/java:
	* decl.c (java_init_decl_processing): Make sure class_type_node
	alignment is not less than 64 bits if hash synchronization isenabled.

boehm-gc:
	* include/gc_priv.h: Define ALIGN_DOUBLE on 32 bit targets if GCJ
	support is enabled, for hash synchronization.

From-SVN: r50523
2002-03-10 03:53:16 +00:00
Joseph Myers 18e1f2bd67 HACKING, [...]: Fix spelling errors.
* HACKING, gnu/gcj/xlib/Pixmap.java, gnu/gcj/xlib/XException.java,
	gnu/java/rmi/rmic/RMIC.java, java/awt/Window.java,
	java/awt/AWTEvent.java, java/io/ByteArrayOutputStream.java,
	java/io/CharConversionException.java,
	java/io/PipedInputStream.java, java/io/PipedReader.java,
	java/io/PrintWriter.java, java/io/WriteAbortedException.java,
	java/io/natFileWin32.cc, java/lang/Class.h,
	java/lang/natClassLoader.cc, java/lang/natObject.cc,
	java/lang/Package.java, java/net/BindException.java,
	java/net/ConnectException.java, java/net/ProtocolException.java,
	java/net/SocketException.java,
	java/net/UnknownServiceException.java,
	java/security/cert/X509Certificate.java,
	java/security/interfaces/DSAKey.java,
	java/security/SecureRandom.java, java/security/SignedObject.java,
	java/sql/DatabaseMetaData.java,
	java/text/DecimalFormatSymbols.java,
	java/util/jar/Attributes.java, java/util/jar/JarEntry.java,
	java/util/jar/JarInputStream.java,
	java/util/jar/JarOutputStream.java, java/util/Calendar.java,
	java/util/Collections.java, java/util/GregorianCalendar.java,
	java/util/HashMap.java, java/util/List.java,
	java/util/Properties.java, java/util/Timer.java,
	java/util/Vector.java, java/util/WeakHashMap.java,
	javax/naming/NamingException.java,
	testsuite/libjava.lang/Thread_Wait.java,
	org/xml/sax/helpers/DefaultHandler.java,
	org/xml/sax/HandlerBase.java, org/xml/sax/SAXParseException.java,
	ChangeLog, acinclude.m4, aclocal.m4, posix-threads.cc: Fix
	spelling errors.
	* configure: Regenerate.

From-SVN: r46665
2001-10-31 00:48:17 +00:00
Loren J. Rittle da97915227 configure.in (case $THREADS): Add *-*-freebsd* configuration.
* configure.in (case $THREADS): Add *-*-freebsd* configuration.
	(HAVE_GETHOSTBYADDR_R): Create a valid, non-optimal
	configuration when gethostbyaddr_r exists yet no prototype
	exists in netdb.h.
	* configure: Rebuilt.
	* posix-threads.cc (INTR): Reuse path for LINUX_THREADS
	with FREEBSD_THREADS.  However, comment different reason.

From-SVN: r46476
2001-10-24 21:57:08 +00:00
Bryce McKinlay f449e8853b posix-threads.cc (_Jv_ThreadInterrupt): Re-enable interrupt of blocking IO via pthread_kill().
* posix-threads.cc (_Jv_ThreadInterrupt): Re-enable interrupt of
	blocking IO via pthread_kill().
	* java/io/natFileDescriptorPosix.cc (write (jint)): Check for thread
	interrupted status flag only if ::write returned an error.
	(write (jbyteArray, jint, jint): Likewise.
	(read (jint)): Likewise.
	(read (jbyteArray, jint, jint): Likewise.

From-SVN: r45719
2001-09-21 05:23:31 +01:00
Tom Tromey 3610e0d548 [multiple changes]
2001-05-23  Tom Tromey  <tromey@redhat.com>

	* posix-threads.cc (_Jv_self_cache): Renamed from self_cache.
	* gcj/Makefile.in: Rebuilt.
	* gcj/Makefile.am (gcj_HEADERS): Added libgcj-config.h.
	* gcj/javaprims.h: Include gcj/libgcj-config.h.
	* gcj/libgcj-config.h.in: New file.
	* libgcj.spec.in (*jc1): Added @HASH_SYNC_SPEC@.
	* configure: Rebuilt.
	* configure.in: Enable hash synchronization by default on some
	platforms.
	(HASH_SYNC_SPEC): New subst.
	(AC_CONFIG_HEADER): Added gcj/libgcj-config.h.
	Correctly use `test -z' instead of `test -n' in a couple places.
	(JV_HASH_SYNCHRONIZATION): Use AC_DEFINE; don't add to
	LIBGCJ_CXXFLAGS.
	* configure.host (enable_java_net_default): Initialize.
	(enable_hash_synchronization_default): New variable.

2001-05-23  Hans Boehm <Hans_Boehm@hp.com>

	* boehm.cc (_Jv_MarkObj): Don't mark sync_info when hash
	synchronization in use.
	(_Jv_MarkArray): Likewise.
	(_Jv_AllocBytes): Don't check return result.
	(handle_out_of_memory): New function.
	(_Jv_InitGC): Set GC_oom_fn.
	(trace_one_vtable): New global.
	(_Jv_AllocTraceOne): New function.
	* configure.in: Added --enable-hash-synchronization.
	* defineclass.cc, prims.cc, resolve.cc, java/lang/natString.cc,
	java/net/natInetAddress.cc: Remove _Jv_AllocBytesChecked.
	* nogc.cc (_Jv_AllocObj): Throw out-of-memory.
	(_Jv_AllocArray): Likewise.
	(_Jv_AllocBytes): Likewise.
	(_Jv_AllocPtrFreeObject): New function.
	(_Jv_AllocTraceOne): Likewise.
	* posix-threads.cc (_Jv_ThreadRegister): Handle slow
	pthread_self().
	(self_cache): New global.
	(_Jv_ThreadSelf_out_of_line): New function.
	* prims.cc (_Jv_AllocBytesChecked): Removed.
	(_Jv_ThrowNoMemory): New function.
	(_Jv_AllocObject): Don't check for null return from allocator.
	(_Jv_NewObjectArray): Likewise.
	(_Jv_AllocPtrFreeObject): New function.
	(_Jv_NewPrimArray): Allocate pointer-free object if possible.
	* include/javaprims.h (_Jv_AllocPtrFreeObject): Declare.
	(_Jv_MonitorEnter, _Jv_MonitorExit): Don't return value.
	* include/boehm-gc.h (_Jv_AllocObj): Define.
	(_Jv_AllocPtrFreeObj): Define.
	* include/jvm.h (_Jv_AllocPtrFreeObj): Declare.
	(_Jv_ThrowNoMemory): Declare.
	(_Jv_AllocTraceOne): Declare.
	(_Jv_AllocBytesChecked): Removed.
	* include/posix-threads.h (_Jv_MutexInit, _Jv_MutexLock,
	_Jv_MutexUnlock): Handle LOCK_DEBUG.
	(_Jv_ThreadSelf): Handle case where system pthread_self() is
	slow.
	* java/lang/Class.h (Class): Declare _Jv_AllocPtrFreeObj as
	friend.
	* java/lang/Object.h (sync_info): Conditional upon presence of
	hash synchronization.
	* java/lang/natObject.cc: Much new code to handle thin locks and
	hash synchronization.
	* java/lang/natString.cc (_Jv_AllocString): Allocate pointer-free
	object if possible.

From-SVN: r42519
2001-05-24 05:40:37 +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 1f4eb17d51 configure.in: Update boehm-gc include dir for new GC version.
* configure.in: Update boehm-gc include dir for new GC version.
	* configure: Rebuilt.
	* exception.cc: Only include <gc.h>. Remove TRUE/FALSE hacks and
	extern "C" wrapper.
	* boehm.cc: Update includes for new GC version. MAKE_PROC is now
	GC_MAKE_PROC. mark_proc is now GC_mark_proc.
	* posix-threads.cc: Only include <gc.h>. Don't need to wrap with
	extern "C".

From-SVN: r42380
2001-05-21 09:37:04 +01:00
Zack Weinberg 0539f1f709 prims.cc (_Jv_ThisExecutable): Use _Jv_Malloc.
* prims.cc (_Jv_ThisExecutable): Use _Jv_Malloc.
	* posix-threads.cc (_Jv_ThreadInitData): Use _Jv_Malloc.
	(_Jv_ThreadDestroyData): Use _Jv_Free.

From-SVN: r41650
2001-04-28 00:04:55 +00:00
Richard Henderson b3208f56cb exception.cc (java_eh_info): Make value type jthrowable.
* exception.cc (java_eh_info): Make value type jthrowable.
	(_Jv_type_matcher): Remove now unneeded cast.
	(_Jv_Throw): Make argument type jthrowable.  Munge name
	for SJLJ_EXCEPTIONS here ...
	* gcj/cni.h: ... not here.
	(JvThrow): Remove.
	* gcj/javaprims.h (_Jv_Throw, _Jv_Sjlj_Throw): Update declarations.

	* defineclass.cc, interpret.cc, jni.cc, posix-threads.cc,
	prims.cc, resolve.cc, gnu/gcj/runtime/natFirstThread.cc,
	gnu/gcj/xlib/natDrawable.cc, gnu/gcj/xlib/natFont.cc,
	gnu/gcj/xlib/natWMSizeHints.cc, gnu/gcj/xlib/natWindowAttributes.cc,
	gnu/gcj/xlib/natXImage.cc, java/io/natFile.cc,
	java/io/natFileDescriptorEcos.cc, java/io/natFileDescriptorPosix.cc,
	java/io/natFileDescriptorWin32.cc, java/io/natFileWin32.cc,
	java/lang/natClass.cc, java/lang/natClassLoader.cc,
	java/lang/natDouble.cc, java/lang/natObject.cc,
	java/lang/natPosixProcess.cc, java/lang/natRuntime.cc,
	java/lang/natString.cc, java/lang/natSystem.cc,
	java/lang/natThread.cc, java/lang/reflect/natArray.cc,
	java/lang/reflect/natConstructor.cc, java/lang/reflect/natField.cc,
	java/lang/reflect/natMethod.cc, java/util/zip/natDeflater.cc,
	java/util/zip/natInflater.cc:
	Use throw, not JvThrow or _Jv_Throw.

From-SVN: r40838
2001-03-25 23:05:32 -08: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
Tom Tromey 304daac5d9 posix-threads.cc (_Jv_CondWait): Check to see if we are interrupted before modifying the cv's wait set.
2000-09-30  Tom Tromey  <tromey@cygnus.com>

        * posix-threads.cc (_Jv_CondWait): Check to see if we are
        interrupted before modifying the cv's wait set.

From-SVN: r36680
2000-09-30 11:01:04 +01:00
Bryce McKinlay f52c723967 Makefile.am (Thread.h): Don't be friends with native threads functions.
2000-09-07  Bryce McKinlay  <bryce@albatross.co.nz>

	* Makefile.am (Thread.h): Don't be friends with native threads
	functions.
	* Makefile.in: Rebuilt.
	* java/lang/Thread.java (interrupt_flag): Make package-private.

From-SVN: r36234
2000-09-07 13:09:41 +01:00
Anthony Green 568fe067bc posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h.
2000-04-08  Anthony Green  <green@cygnus.com>

	* posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h.
	(_Jv_MutexUnlock): Ditto.
	* include/posix-threads.h (_Jv_MutexLock): From posix-threads.cc.
	(_Jv_MutexUnlock): Ditto.

From-SVN: r33037
2000-04-09 05:41:56 +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 2ba5f77454 All files: Updated copyright information.
* All files: Updated copyright information.
	* COPYING: New file.
	* COPYING.LIB: Removed.
	* LIBGCJ_LICENSE: We now use GPL + special exception.

From-SVN: r32387
2000-03-07 19:55:28 +00:00
Tom Tromey 7c734b1758 * All files: Updated copyright to reflect Cygnus purchase.
From-SVN: r31504
2000-01-19 18:39:27 +00:00
Bryce McKinlay 43cbc9430d natObject.cc (notify): Throw message with IllegalMonitorStateException.
1999-12-22  Bryce McKinlay  <bryce@albatross.co.nz>

        * java/lang/natObject.cc (notify): Throw message with
        IllegalMonitorStateException.
        (notifyAll): Ditto.
        (wait): Ditto.
        * java/lang/Thread.java (isInterrupted): Don't clear interrupt_flag.
        (isInterrupted_): New function, which does clear interrupt_flag.
        (interrupt): Use `isInterrupted_'.
        * java/lang/natThread.cc (interrupt): Add comment.
        (join): Set `Prev' in joiner loop.
        Change various calls to `isInterrupted' to use `isInterrupted_'.
        * posix-threads.cc (_Jv_CondWait): Allways use pthread_cond_timedwait
        on linux. Set result to 0 on an interrupt. Test interrupted status
        of java Thread object directly.
        FLAG_INTERRUPTED: removed.
        (_Jv_ThreadStart): Throw OutOfMemoryError if pthread_create fails.
        (_Jv_ThreadInterrupt): Don't set FLAG_INTERRUPTED.
        (_Jv_InitThreads): Don't block SIGINT.
        (_Jv_ThreadWait): Don't configure SIGINT handler.

From-SVN: r31082
1999-12-24 01:00:46 +00:00
Tom Tromey 4cb74b7695 re GNATS libgcj/98 (pthread_mutex_init in libjava/posix-threads.cc)
* posix-threads.cc (_Jv_MutexInit): Use _Jv_PthreadGetMutex to get
	mutex to initialize.  Initialize `count' if required.
	Fixes PR libgcj/98.

From-SVN: r30725
1999-11-30 18:53:15 +00:00
Tom Tromey 16f39e241a quick-threads.h (_Jv_ThreadCancel): Removed.
* include/quick-threads.h (_Jv_ThreadCancel): Removed.
	(_Jv_ThreadDestroy): Likewise.
	* include/no-threads.h (_Jv_ThreadCancel): Removed.
	(_Jv_ThreadDestroy): Likewise.
	* include/posix-threads.h (struct _Jv_Thread_t): Removed
	`exception' field.
	(_Jv_ThreadCancel): Removed decl.
	(_Jv_ThreadDestroy): Removed.
	* posix-threads.cc (_Jv_ThreadCancel): Removed.
	(throw_cleanup): Removed.
	(really_start): Don't push or pop cleanup.
	(_Jv_ThreadInitData): Don't initialize `exception' field.
	* java/lang/Thread.java (stop): Officially unimplemented.
	* java/lang/natThread.cc (stop): Officially unimplemented.

From-SVN: r30392
1999-11-04 16:45:11 +00:00
Bryce McKinlay 8fbe2d958a posix-threads.cc: Don't include boehm-config.h.
1999-11-02  Bryce McKinlay  <bryce@albatross.co.nz>

        * posix-threads.cc: Don't include boehm-config.h. Include gcconfig.h
        instead.

From-SVN: r30365
1999-11-03 03:10:22 +00:00
Bryce McKinlay 5e4f217316 posix-threads.cc: Don't include boehm-config.h.
1999-11-02  Bryce McKinlay  <bryce@albatross.co.nz>

        * posix-threads.cc: Don't include boehm-config.h.

From-SVN: r30361
1999-11-03 02:13:40 +00:00
Tom Tromey 27e934d8ba configure: Rebuilt.
* configure: Rebuilt.
	* configure.in: Build include/Makefile.
	* Makefile.in: Rebuilt.
	* Makefile.am (SUBDIRS): Added gcj and include.
	(install-data-local): New target.
	(extra_headers): New macro.
	* include/Makefile.in: New file.
	* include/Makefile.am: New file.

	* interpret.cc: Don't include gcj/field.h or gcj/cni.h.
	* java/lang/reflect/natField.cc: Don't include gcj/field.h or
	gcj/cni.h.
	* boehm.cc: Don't include java-threads.h or gcj/field.h.
	* resolve.cc: Include config.h.
	* defineclass.cc: Include config.h.
	* include/java-interp.h: Don't include config.h.
	* include/jvm.h: Include java-threads.h, Object.h, java-gc.h,
	cni.h.

	* gcj/javaprims.h: Regenerated namespace decls.
	* classes.pl (scan): Don't put `;' after closing brace.

	* Makefile.in: Rebuilt.
	* Makefile.am (INCLUDES): Added -I for top_srcdir.
	* configure.in: Create gcj/Makefile.
	* gcj/Makefile.in: New file.
	* gcj/Makefile.am: New file.
	* java/lang/Object.h: Don't include any other headers.
	* gcj/array.h: Renamed from include/java-array.h.
	* gcj/field.h: Renamed from include/java-field.h.
	* gcj/method.h: Renamed from include/java-method.h.
	* gcj/cni.h, gcj/javaprims.h: Moved from include/.
	Updated all files to reflect new include structure.

From-SVN: r29278
1999-09-10 22:03:10 +00:00
Tom Tromey 472236af04 posix-threads.cc (_Jv_CondWait): pthread_ calls return error code and don't set errno.
* posix-threads.cc (_Jv_CondWait): pthread_ calls return error
	code and don't set errno.

From-SVN: r29179
1999-09-08 02:31:33 +00:00
Tom Tromey fd59e3a04e posix-threads.cc (_Jv_CondWait): Check `errno' against EINTR, not `r'.
1999-09-07  Tom Tromey  <tromey@cygnus.com>

	* posix-threads.cc (_Jv_CondWait): Check `errno' against EINTR,
	not `r'.  Changed `done_sleeping' to a `bool'.

1999-09-07  Matt Welsh <mdw@cs.berkeley.edu

	* libjava/posix-threads.cc: Added _Jv_ThreadDataKey.
	Added FLAG_INTERRUPTED to indicate that a thread was interrupted
	by another thread, rather than by the GC.
	(_Jv_CondWait): Prevent premature thread wakeup by GC.
	(_Jv_InitThreads): Initialize _Jv_ThreadDataKey.
	* libjava/include/posix-threads.h (_Jv_ThreadCurrentData): New
	function.

From-SVN: r29177
1999-09-08 00:43:06 +00:00
Tom Tromey 45329b398e posix-threads.cc (_Jv_CondWait): Use _Jv_PthreadGetMutex.
* posix-threads.cc (_Jv_CondWait): Use _Jv_PthreadGetMutex.
	* include/posix-threads.h (_Jv_Mutex_t): Define as structure,
	except on Linux.
	(_Jv_PthreadGetMutex): New function.
	(_Jv_PthreadCheckMonitor): Use it.
	(_Jv_MutexInit): Likewise.  ALso, initialize `count'.
	(_Jv_MutexLock): Update `count'.
	(_Jv_MutexUnlock): Likewise.
	(_Jv_PthreadCheckMonitor): Use Linux-specific knowledge when
	appropriate.

From-SVN: r29032
1999-09-01 21:03:18 +00:00
Tom Tromey 6e87747b6d posix-threads.cc (_Jv_CondWait): Call _Jv_PthreadCheckMonitor.
* posix-threads.cc (_Jv_CondWait): Call _Jv_PthreadCheckMonitor.
	* include/posix-threads.h (_Jv_PthreadCheckMonitor): New
	function.
	(_Jv_CondNotify): Use it.
	(_Jv_CondNotifyAll): Likewise.

	* java/lang/Class.h (JV_STATE_NOTHING): Correct misspelling.

From-SVN: r29030
1999-09-01 18:29:39 +00:00
Bryce McKinlay d55d01bdf8 * posix-threads.cc: Include <errno.h>.
From-SVN: r28831
1999-08-25 01:46:23 +01:00
Tom Tromey 657ac7664c boehm.cc: Undefine TRUE and FALSE.
* boehm.cc: Undefine TRUE and FALSE.

	* posix-threads.cc (_Jv_CondWait): Use ETIMEDOUT, not ETIME.

From-SVN: r28810
1999-08-24 04:01:06 +00:00
Tom Tromey 33e8c77e61 re GNATS libgcj/40 (wait(timeout) wrongly throws IllegalMonitorState exception)
* posix-threads.cc (_Jv_CondWait): Treat a timeout as a normal
	result.  PR 40.

From-SVN: r28799
1999-08-22 02:37:04 +00:00
Bryce McKinlay 00af55a292 * posix-threads.cc (_Jv_CondWait): Fix currentTimeMillis() overflow.
From-SVN: r27524
1999-06-14 18:20:35 +01:00
Tom Tromey ee9dd3721b Initial revision
From-SVN: r26263
1999-04-07 14:42:40 +00:00