aboutsummaryrefslogtreecommitdiffstats
path: root/gc/solaris_pthreads.c
diff options
context:
space:
mode:
authorAkinori Ito <aito@eie.yz.yamagata-u.ac.jp>2001-11-09 04:59:17 +0000
committerAkinori Ito <aito@eie.yz.yamagata-u.ac.jp>2001-11-09 04:59:17 +0000
commit6c63633545c254dc085402e0f927a6826d1dd229 (patch)
tree0126fb5598304c713ea1276e294da9098b5df3b4 /gc/solaris_pthreads.c
parentInitial revision (diff)
downloadw3m-6c63633545c254dc085402e0f927a6826d1dd229.tar.gz
w3m-6c63633545c254dc085402e0f927a6826d1dd229.zip
Updates from 0.2.1 into 0.2.1-inu-1.5release-0-2-1-inu-1-5
Diffstat (limited to '')
-rw-r--r--gc/solaris_pthreads.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/gc/solaris_pthreads.c b/gc/solaris_pthreads.c
index eb0ce67..8470eaf 100644
--- a/gc/solaris_pthreads.c
+++ b/gc/solaris_pthreads.c
@@ -16,10 +16,10 @@
* Modified Peter C. for Solaris Posix Threads.
*/
/* Boehm, September 14, 1994 4:44 pm PDT */
-/* $Id: solaris_pthreads.c,v 1.1 2001/11/08 05:17:57 a-ito Exp $ */
+/* $Id: solaris_pthreads.c,v 1.2 2001/11/09 04:59:18 a-ito Exp $ */
-# if defined(_SOLARIS_PTHREADS)
-# include "gc_priv.h"
+# if defined(GC_SOLARIS_PTHREADS) || defined(_SOLARIS_PTHREADS)
+# include "private/gc_priv.h"
# include <pthread.h>
# include <thread.h>
# include <signal.h>
@@ -36,7 +36,7 @@
# define _CLASSIC_XOPEN_TYPES
# include <unistd.h>
# include <errno.h>
-# include "solaris_threads.h"
+# include "private/solaris_threads.h"
# include <stdio.h>
#undef pthread_join
@@ -77,14 +77,16 @@ 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) {
@@ -94,7 +96,11 @@ GC_pthread_create(pthread_t *new_thread,
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 +116,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);
-
- (void)pthread_attr_getdetachstate(attr_in, &flag);
- if (flag == PTHREAD_CREATE_DETACHED) {
- my_flags |= DETACHED;
+ 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);
}
- (void)pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
/*
* thr_create can call malloc(), which if redirected will
* attempt to acquire the allocation lock.