Commit f6d882d9 by Loren J. Rittle Committed by Loren J. Rittle

gc_pthread_redirects.h: Generalize test to use GC_PTHREADS.

	* include/gc_pthread_redirects.h: Generalize test to use GC_PTHREADS.
	* linux_threads.c (WRAP_FUNC(pthread_join)): Conditionalized on
	GC_FREEBSD_THREADS, handle strange interaction between system
	pthread implementation and boehm-gc signal-handler architecture.
	* tests/test.c (main): Conditionalized on GC_FREEBSD_THREADS,
	set stack.
	* include/private/gcconfig.h (configuration keyed off FREEBSD):
	Define SIG_SUSPEND, SIG_THR_RESTART.  Do not define
	MPROTECT_VDB when GC_FREEBSD_THREADS is defined.

From-SVN: r46307
parent 808dbdd5
2001-10-16 Loren J. Rittle <ljrittle@acm.org> 2001-10-16 Loren J. Rittle <ljrittle@acm.org>
* include/gc_pthread_redirects.h: Generalize test to use GC_PTHREADS.
* linux_threads.c (WRAP_FUNC(pthread_join)): Conditionalized on
GC_FREEBSD_THREADS, handle strange interaction between system
pthread implementation and boehm-gc signal-handler architecture.
* tests/test.c (main): Conditionalized on GC_FREEBSD_THREADS,
set stack.
* include/private/gcconfig.h (configuration keyed off FREEBSD):
Define SIG_SUSPEND, SIG_THR_RESTART. Do not define
MPROTECT_VDB when GC_FREEBSD_THREADS is defined.
2001-10-16 Loren J. Rittle <ljrittle@acm.org>
* Makefile.am (test.o): Find tests/test.c in $(srcdir). * Makefile.am (test.o): Find tests/test.c in $(srcdir).
* Makefile.in: Rebuilt. * Makefile.in: Rebuilt.
......
...@@ -44,9 +44,7 @@ ...@@ -44,9 +44,7 @@
#endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */ #endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */
#if !defined(GC_USE_LD_WRAP) && \ #if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS) && !defined(GC_SOLARIS_PTHREADS)
(defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
|| defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS))
/* We treat these similarly. */ /* We treat these similarly. */
# include <pthread.h> # include <pthread.h>
# include <signal.h> # include <signal.h>
......
...@@ -1017,7 +1017,11 @@ ...@@ -1017,7 +1017,11 @@
# endif # endif
# ifdef FREEBSD # ifdef FREEBSD
# define OS_TYPE "FREEBSD" # define OS_TYPE "FREEBSD"
# define MPROTECT_VDB # ifndef GC_FREEBSD_THREADS
# define MPROTECT_VDB
# endif
# define SIG_SUSPEND SIGUSR1
# define SIG_THR_RESTART SIGUSR2
# define FREEBSD_STACKBOTTOM # define FREEBSD_STACKBOTTOM
# ifdef __ELF__ # ifdef __ELF__
# define DYNAMIC_LOADING # define DYNAMIC_LOADING
......
...@@ -1272,6 +1272,17 @@ int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval) ...@@ -1272,6 +1272,17 @@ int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval)
/* cant have been recycled by pthreads. */ /* cant have been recycled by pthreads. */
UNLOCK(); UNLOCK();
result = REAL_FUNC(pthread_join)(thread, retval); result = REAL_FUNC(pthread_join)(thread, retval);
# if defined (GC_FREEBSD_THREADS)
/* On FreeBSD, the wrapped pthread_join() sometimes returns (what
appears to be) a spurious EINTR which caused the test and real code
to gratuitously fail. Having looked at system pthread library source
code, I see how this return code may be generated. In one path of
code, pthread_join() just returns the errno setting of the thread
being joined. This does not match the POSIX specification or the
local man pages thus I have taken the liberty to catch this one
spurious return value properly conditionalized on GC_FREEBSD_THREADS. */
if (result == EINTR) result = 0;
# endif
if (result == 0) { if (result == 0) {
LOCK(); LOCK();
/* Here the pthread thread id may have been recycled. */ /* Here the pthread thread id may have been recycled. */
......
...@@ -1624,7 +1624,7 @@ main() ...@@ -1624,7 +1624,7 @@ main()
} }
# endif /* GC_HPUX_THREADS */ # endif /* GC_HPUX_THREADS */
pthread_attr_init(&attr); pthread_attr_init(&attr);
# if defined(GC_IRIX_THREADS) # if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS)
pthread_attr_setstacksize(&attr, 1000000); pthread_attr_setstacksize(&attr, 1000000);
# endif # endif
n_tests = 0; n_tests = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment