=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/gc/solaris_pthreads.c,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -p -r1.1.1.1 -r1.5 --- OpenXM_contrib2/asir2000/gc/solaris_pthreads.c 1999/12/03 07:39:10 1.1.1.1 +++ OpenXM_contrib2/asir2000/gc/solaris_pthreads.c 2002/07/24 08:00:12 1.5 @@ -13,13 +13,11 @@ /* * Support code for Solaris threads. Provides functionality we wish Sun * had provided. Relies on some information we probably shouldn't rely on. - * Modified Peter C. for Solaris Posix Threads. + * Modified by Peter C. for Solaris Posix Threads. */ -/* Boehm, September 14, 1994 4:44 pm PDT */ -/* $Id: solaris_pthreads.c,v 1.1.1.1 1999/12/03 07:39:10 noro Exp $ */ -# if defined(_SOLARIS_PTHREADS) -# include "gc_priv.h" +# if defined(GC_SOLARIS_PTHREADS) +# include "private/gc_priv.h" # include # include # include @@ -36,7 +34,7 @@ # define _CLASSIC_XOPEN_TYPES # include # include -# include "solaris_threads.h" +# include "private/solaris_threads.h" # include #undef pthread_join @@ -77,24 +75,30 @@ GC_pthread_create(pthread_t *new_thread, pthread_attr_t attr; word my_flags = 0; int flag; - void * stack; - size_t stack_size; + void * stack = 0; + size_t stack_size = 0; int n; struct sched_param schedparam; - (void)pthread_attr_getstacksize(attr_in, &stack_size); - (void)pthread_attr_getstackaddr(attr_in, &stack); (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_thr_initialized) { - GC_thr_init(); + if (!GC_is_initialized) { + GC_init_inner(); } GC_multithreaded++; if (stack == 0) { if (stack_size == 0) - stack_size = GC_min_stack_sz; + 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(); @@ -110,20 +114,22 @@ GC_pthread_create(pthread_t *new_thread, } (void)pthread_attr_setstacksize(&attr, stack_size); (void)pthread_attr_setstackaddr(&attr, stack); - (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); + 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_getdetachstate(attr_in, &flag); + if (flag == PTHREAD_CREATE_DETACHED) { + my_flags |= DETACHED; + } + (void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); } - (void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); /* * thr_create can call malloc(), which if redirected will * attempt to acquire the allocation lock. @@ -168,5 +174,5 @@ GC_pthread_create(pthread_t *new_thread, int GC_no_sunOS_pthreads; #endif -# endif /* SOLARIS_THREADS */ +# endif /* GC_SOLARIS_PTHREADS */