Commit 28e2ff77 by Rainer Orth Committed by Rainer Orth

re PR boehm-gc/21940 (boehm-gc gctest fails on Solaris 10/x86)

	PR boehm-gc/21940
	PR boehm-gc/21942
	* configure.ac (GC_SOLARIS_THREADS): Don't define on *-*-solaris*.
	Use alternate thread library in /usr/lib/lwp.
	* configure: Regenerate.
	* dyn_load.c: Use GC_SOLARIS_PTHREADS.
	* include/gc_config_macros.h (GC_SOLARIS_THREADS): Don't define.
	* include/private/gcconfig.h: Handle 64-bit Solaris 2/x86.
	(GC_SOLARIS_THREADS): Don't define.
	* include/private/solaris_threads.h: Remove.
	* pthread_support.c (GC_thr_init) [GC_SOLARIS_PTHREADS]: Determine
	GC_nprocs via sysconf().
	* Makefile.am (libgcjgc_la_SOURCES): Remove solaris_pthreads.c and
	solaris_threads.c.
	(gctest_LDADD): Use THREADLIBS instead of THREADDLLIBS.
	* Makefile.in: Regenerate.	 
	* solaris_pthreads.c: Remove.
	* solaris_threads.c: Remove.

From-SVN: r126211
parent a3b7729c
2007-07-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR boehm-gc/21940
PR boehm-gc/21942
* configure.ac (GC_SOLARIS_THREADS): Don't define on *-*-solaris*.
Use alternate thread library in /usr/lib/lwp.
* configure: Regenerate.
* dyn_load.c: Use GC_SOLARIS_PTHREADS.
* include/gc_config_macros.h (GC_SOLARIS_THREADS): Don't define.
* include/private/gcconfig.h: Handle 64-bit Solaris 2/x86.
(GC_SOLARIS_THREADS): Don't define.
* include/private/solaris_threads.h: Remove.
* pthread_support.c (GC_thr_init) [GC_SOLARIS_PTHREADS]: Determine
GC_nprocs via sysconf().
* Makefile.am (libgcjgc_la_SOURCES): Remove solaris_pthreads.c and
solaris_threads.c.
(gctest_LDADD): Use THREADLIBS instead of THREADDLLIBS.
* Makefile.in: Regenerate.
* solaris_pthreads.c: Remove.
* solaris_threads.c: Remove.
2007-06-22 Jakub Jelinek <jakub@redhat.com> 2007-06-22 Jakub Jelinek <jakub@redhat.com>
* pthread_support.c (GC_get_thread_stack_base): Handle * pthread_support.c (GC_get_thread_stack_base): Handle
......
...@@ -21,7 +21,7 @@ libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \ ...@@ -21,7 +21,7 @@ libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \ dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \
malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \ malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \ specific.c stubborn.c typd_mlc.c \
backgraph.c win32_threads.c \ backgraph.c win32_threads.c \
pthread_support.c pthread_stop_world.c darwin_stop_world.c \ pthread_support.c pthread_stop_world.c darwin_stop_world.c \
$(asm_libgcjgc_sources) $(asm_libgcjgc_sources)
...@@ -49,7 +49,7 @@ AM_CFLAGS = @GC_CFLAGS@ ...@@ -49,7 +49,7 @@ AM_CFLAGS = @GC_CFLAGS@
check_PROGRAMS = gctest check_PROGRAMS = gctest
gctest_SOURCES = tests/test.c gctest_SOURCES = tests/test.c
gctest_LDADD = ./libgcjgc.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS) gctest_LDADD = ./libgcjgc.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
gctest_LDFLAGS = -shared-libgcc gctest_LDFLAGS = -shared-libgcc
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc
TESTS = gctest TESTS = gctest
......
...@@ -62,9 +62,8 @@ DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub \ ...@@ -62,9 +62,8 @@ DIST_COMMON = $(srcdir)/../config.guess $(srcdir)/../config.sub \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \ $(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \ $(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \ $(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \
$(srcdir)/../compile $(srcdir)/../compile $(srcdir)/../compile \ $(srcdir)/../ltmain.sh $(srcdir)/../config.guess \
$(srcdir)/../compile $(srcdir)/../ltmain.sh \ $(srcdir)/../config.sub
$(srcdir)/../config.guess $(srcdir)/../config.sub
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
...@@ -89,8 +88,7 @@ am_libgcjgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \ ...@@ -89,8 +88,7 @@ am_libgcjgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \
dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \ dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \
headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \ headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \
new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \ new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \
real_malloc.lo reclaim.lo solaris_pthreads.lo \ real_malloc.lo reclaim.lo specific.lo stubborn.lo typd_mlc.lo \
solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo win32_threads.lo pthread_support.lo \ backgraph.lo win32_threads.lo pthread_support.lo \
pthread_stop_world.lo darwin_stop_world.lo $(am__objects_1) pthread_stop_world.lo darwin_stop_world.lo $(am__objects_1)
libgcjgc_la_OBJECTS = $(am_libgcjgc_la_OBJECTS) libgcjgc_la_OBJECTS = $(am_libgcjgc_la_OBJECTS)
...@@ -98,8 +96,7 @@ am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \ ...@@ -98,8 +96,7 @@ am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \
dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \ dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo \
headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \ headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \
new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \ new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \
real_malloc.lo reclaim.lo solaris_pthreads.lo \ real_malloc.lo reclaim.lo specific.lo stubborn.lo typd_mlc.lo \
solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo \
backgraph.lo win32_threads.lo pthread_support.lo \ backgraph.lo win32_threads.lo pthread_support.lo \
pthread_stop_world.lo darwin_stop_world.lo $(am__objects_1) pthread_stop_world.lo darwin_stop_world.lo $(am__objects_1)
am_libgcjgc_convenience_la_OBJECTS = $(am__objects_2) am_libgcjgc_convenience_la_OBJECTS = $(am__objects_2)
...@@ -108,7 +105,8 @@ libgcjgc_convenience_la_OBJECTS = \ ...@@ -108,7 +105,8 @@ libgcjgc_convenience_la_OBJECTS = \
am__dirstamp = $(am__leading_dot)dirstamp am__dirstamp = $(am__leading_dot)dirstamp
am_gctest_OBJECTS = tests/test.$(OBJEXT) am_gctest_OBJECTS = tests/test.$(OBJEXT)
gctest_OBJECTS = $(am_gctest_OBJECTS) gctest_OBJECTS = $(am_gctest_OBJECTS)
gctest_DEPENDENCIES = ./libgcjgc.la $(am__DEPENDENCIES_1) gctest_DEPENDENCIES = ./libgcjgc.la $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include
depcomp = depcomp =
am__depfiles_maybe = am__depfiles_maybe =
...@@ -276,7 +274,7 @@ libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \ ...@@ -276,7 +274,7 @@ libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \ dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c \
malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \ malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \ specific.c stubborn.c typd_mlc.c \
backgraph.c win32_threads.c \ backgraph.c win32_threads.c \
pthread_support.c pthread_stop_world.c darwin_stop_world.c \ pthread_support.c pthread_stop_world.c darwin_stop_world.c \
$(asm_libgcjgc_sources) $(asm_libgcjgc_sources)
...@@ -298,7 +296,7 @@ libgcjgc_convenience_la_DEPENDENCIES = @addobjs@ ...@@ -298,7 +296,7 @@ libgcjgc_convenience_la_DEPENDENCIES = @addobjs@
AM_CXXFLAGS = @GC_CFLAGS@ AM_CXXFLAGS = @GC_CFLAGS@
AM_CFLAGS = @GC_CFLAGS@ AM_CFLAGS = @GC_CFLAGS@
gctest_SOURCES = tests/test.c gctest_SOURCES = tests/test.c
gctest_LDADD = ./libgcjgc.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS) gctest_LDADD = ./libgcjgc.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
gctest_LDFLAGS = -shared-libgcc gctest_LDFLAGS = -shared-libgcc
TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc TESTS_ENVIRONMENT = LD_LIBRARY_PATH=../../$(MULTIBUILDTOP)gcc
TESTS = gctest TESTS = gctest
......
...@@ -14314,14 +14314,14 @@ _ACEOF ...@@ -14314,14 +14314,14 @@ _ACEOF
*-*-solaris*) *-*-solaris*)
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define GC_SOLARIS_THREADS 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define GC_SOLARIS_PTHREADS 1 #define GC_SOLARIS_PTHREADS 1
_ACEOF _ACEOF
# Need to use alternate thread library, otherwise gctest hangs
# on Solaris 8.
multi_os_directory=`$CC -print-multi-os-directory`
THREADLIBS="-L/usr/lib/lwp/$multi_os_directory \
-R/usr/lib/lwp/$multi_os_directory -lpthread -lthread -lrt"
;; ;;
*-*-irix*) *-*-irix*)
......
...@@ -173,8 +173,12 @@ case "$THREADS" in ...@@ -173,8 +173,12 @@ case "$THREADS" in
THREADLIBS=-pthread THREADLIBS=-pthread
;; ;;
*-*-solaris*) *-*-solaris*)
AC_DEFINE(GC_SOLARIS_THREADS,1,[support for Solaris (thr_) threads])
AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads]) AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
# Need to use alternate thread library, otherwise gctest hangs
# on Solaris 8.
multi_os_directory=`$CC -print-multi-os-directory`
THREADLIBS="-L/usr/lib/lwp/$multi_os_directory \
-R/usr/lib/lwp/$multi_os_directory -lpthread -lthread -lrt"
;; ;;
*-*-irix*) *-*-irix*)
AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads]) AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
......
...@@ -225,7 +225,7 @@ static ptr_t GC_first_common() ...@@ -225,7 +225,7 @@ static ptr_t GC_first_common()
# if defined(SUNOS4) || defined(SUNOS5DL) # if defined(SUNOS4) || defined(SUNOS5DL)
/* Add dynamic library data sections to the root set. */ /* Add dynamic library data sections to the root set. */
# if !defined(PCR) && !defined(GC_SOLARIS_THREADS) && defined(THREADS) # if !defined(PCR) && !defined(GC_SOLARIS_PTHREADS) && defined(THREADS)
# ifndef SRC_M3 # ifndef SRC_M3
--> fix mutual exclusion with dlopen --> fix mutual exclusion with dlopen
# endif /* We assume M3 programs don't call dlopen for now */ # endif /* We assume M3 programs don't call dlopen for now */
......
...@@ -72,10 +72,6 @@ ...@@ -72,10 +72,6 @@
# define GC_WIN32_THREADS # define GC_WIN32_THREADS
#endif #endif
#if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
# define GC_SOLARIS_THREADS
#endif
# define __GC # define __GC
# ifndef _WIN32_WCE # ifndef _WIN32_WCE
# include <stddef.h> # include <stddef.h>
......
...@@ -153,6 +153,11 @@ ...@@ -153,6 +153,11 @@
# define SUNOS5 # define SUNOS5
# define mach_type_known # define mach_type_known
# endif # endif
# if defined(sun) && defined(__amd64)
# define X86_64
# define SUNOS5
# define mach_type_known
# endif
# if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__) # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
# define I386 # define I386
# define OS2 # define OS2
...@@ -2041,6 +2046,36 @@ ...@@ -2041,6 +2046,36 @@
extern char etext[]; extern char etext[];
# define SEARCH_FOR_DATA_START # define SEARCH_FOR_DATA_START
# endif # endif
# ifdef SUNOS5
# define ELF_CLASS ELFCLASS64
# define OS_TYPE "SUNOS5"
extern int _etext[], _end[];
extern ptr_t GC_SysVGetDataStart();
# define DATASTART GC_SysVGetDataStart(0x1000, _etext)
# define DATAEND (_end)
/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
/* but reportedly breaks under 2.8. It appears that the stack */
/* base is a property of the executable, so this should not break */
/* old executables. */
/* HEURISTIC2 probably works, but this appears to be preferable. */
/* # include <sys/vm.h> */
/* # define STACKBOTTOM USRSTACK */
# define HEURISTIC2
# define PROC_VDB
# define DYNAMIC_LOADING
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
# define USE_MMAP
/* Otherwise we now use calloc. Mmap may result in the */
/* heap interleaved with thread stacks, which can result in */
/* excessive blacklisting. Sbrk is unusable since it */
/* doesn't interact correctly with the system malloc. */
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
# else
# define HEAP_START DATAEND
# endif
# endif
# endif # endif
#if defined(LINUX) && defined(USE_MMAP) #if defined(LINUX) && defined(USE_MMAP)
...@@ -2186,11 +2221,6 @@ ...@@ -2186,11 +2221,6 @@
((word*)x)[1] = 0; ((word*)x)[1] = 0;
# endif /* CLEAR_DOUBLE */ # endif /* CLEAR_DOUBLE */
/* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
# if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
# define GC_SOLARIS_THREADS
# endif
# if defined(GC_IRIX_THREADS) && !defined(IRIX5) # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
--> inconsistent configuration --> inconsistent configuration
# endif # endif
......
#ifdef GC_SOLARIS_THREADS
/* The set of all known threads. We intercept thread creation and */
/* joins. We never actually create detached threads. We allocate all */
/* new thread stacks ourselves. These allow us to maintain this */
/* data structure. */
/* Protected by GC_thr_lock. */
/* Some of this should be declared volatile, but that's incosnsistent */
/* with some library routine declarations. In particular, the */
/* definition of cond_t doesn't mention volatile! */
typedef struct GC_Thread_Rep {
struct GC_Thread_Rep * next;
thread_t id;
word flags;
# define FINISHED 1 /* Thread has exited. */
# define DETACHED 2 /* Thread is intended to be detached. */
# define CLIENT_OWNS_STACK 4
/* Stack was supplied by client. */
# define SUSPNDED 8 /* Currently suspended. */
/* SUSPENDED is used insystem header. */
ptr_t stack;
size_t stack_size;
cond_t join_cv;
void * status;
} * GC_thread;
extern GC_thread GC_new_thread(thread_t id);
extern GC_bool GC_thr_initialized;
extern volatile GC_thread GC_threads[];
extern size_t GC_min_stack_sz;
extern size_t GC_page_sz;
extern void GC_thr_init(void);
extern ptr_t GC_stack_alloc(size_t * stack_size);
extern void GC_stack_free(ptr_t stack, size_t size);
# endif /* GC_SOLARIS_THREADS */
...@@ -883,7 +883,8 @@ void GC_thr_init() ...@@ -883,7 +883,8 @@ void GC_thr_init()
# if defined(GC_HPUX_THREADS) # if defined(GC_HPUX_THREADS)
GC_nprocs = pthread_num_processors_np(); GC_nprocs = pthread_num_processors_np();
# endif # endif
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) # if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) \
|| defined(GC_SOLARIS_PTHREADS)
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN); GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1; if (GC_nprocs <= 0) GC_nprocs = 1;
# endif # endif
......
/*
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* Support code for Solaris threads. Provides functionality we wish Sun
* had provided. Relies on some information we probably shouldn't rely on.
* Modified by Peter C. for Solaris Posix Threads.
*/
# include "private/gc_priv.h"
# if defined(GC_SOLARIS_PTHREADS)
# include <pthread.h>
# include <thread.h>
# include <signal.h>
# include <fcntl.h>
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/time.h>
# include <sys/resource.h>
# include <sys/stat.h>
# include <sys/syscall.h>
# include <sys/procfs.h>
# include <sys/lwp.h>
# include <sys/reg.h>
# define _CLASSIC_XOPEN_TYPES
# include <unistd.h>
# include <errno.h>
# include "private/solaris_threads.h"
# include <stdio.h>
#undef pthread_join
#undef pthread_create
pthread_cond_t GC_prom_join_cv; /* Broadcast when any thread terminates */
pthread_cond_t GC_create_cv; /* Signalled when a new undetached */
/* thread starts. */
extern GC_bool GC_multithreaded;
/* We use the allocation lock to protect thread-related data structures. */
/* We stop the world using /proc primitives. This makes some */
/* minimal assumptions about the threads implementation. */
/* We don't play by the rules, since the rules make this */
/* impossible (as of Solaris 2.3). Also note that as of */
/* Solaris 2.3 the various thread and lwp suspension */
/* primitives failed to stop threads by the time the request */
/* is completed. */
int GC_pthread_join(pthread_t wait_for, void **status)
{
return GC_thr_join((thread_t)wait_for, NULL, status);
}
int
GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr_in,
void * (*thread_execp)(void *), void *arg)
{
int result;
GC_thread t;
pthread_t my_new_thread;
pthread_attr_t attr;
word my_flags = 0;
int flag;
void * stack = 0;
size_t stack_size = 0;
int n;
struct sched_param schedparam;
(void)pthread_attr_init(&attr);
if (attr_in != 0) {
(void)pthread_attr_getstacksize(attr_in, &stack_size);
(void)pthread_attr_getstackaddr(attr_in, &stack);
}
LOCK();
if (!GC_is_initialized) {
GC_init_inner();
}
GC_multithreaded++;
if (stack == 0) {
if (stack_size == 0)
stack_size = 1048576;
/* ^-- 1 MB (this was GC_min_stack_sz, but that
* violates the pthread_create documentation which
* says the default value if none is supplied is
* 1MB) */
else
stack_size += thr_min_stack();
stack = (void *)GC_stack_alloc(&stack_size);
if (stack == 0) {
GC_multithreaded--;
UNLOCK();
errno = ENOMEM;
return -1;
}
} else {
my_flags |= CLIENT_OWNS_STACK;
}
(void)pthread_attr_setstacksize(&attr, stack_size);
(void)pthread_attr_setstackaddr(&attr, stack);
if (attr_in != 0) {
(void)pthread_attr_getscope(attr_in, &n);
(void)pthread_attr_setscope(&attr, n);
(void)pthread_attr_getschedparam(attr_in, &schedparam);
(void)pthread_attr_setschedparam(&attr, &schedparam);
(void)pthread_attr_getschedpolicy(attr_in, &n);
(void)pthread_attr_setschedpolicy(&attr, n);
(void)pthread_attr_getinheritsched(attr_in, &n);
(void)pthread_attr_setinheritsched(&attr, n);
(void)pthread_attr_getdetachstate(attr_in, &flag);
if (flag == PTHREAD_CREATE_DETACHED) {
my_flags |= DETACHED;
}
(void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
}
/*
* thr_create can call malloc(), which if redirected will
* attempt to acquire the allocation lock.
* Unlock here to prevent deadlock.
*/
#if 0
#ifdef I386
UNLOCK();
#endif
#endif
result =
pthread_create(&my_new_thread, &attr, thread_execp, arg);
#if 0
#ifdef I386
LOCK();
#endif
#endif
if (result == 0) {
t = GC_new_thread(my_new_thread);
t -> flags = my_flags;
if (!(my_flags & DETACHED)) cond_init(&(t->join_cv), USYNC_THREAD, 0);
t -> stack = stack;
t -> stack_size = stack_size;
if (new_thread != 0) *new_thread = my_new_thread;
pthread_cond_signal(&GC_create_cv);
} else {
if (!(my_flags & CLIENT_OWNS_STACK)) {
GC_stack_free(stack, stack_size);
}
GC_multithreaded--;
}
UNLOCK();
pthread_attr_destroy(&attr);
return(result);
}
# else
#ifndef LINT
int GC_no_sunOS_pthreads;
#endif
# endif /* GC_SOLARIS_PTHREADS */
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