From 0f3efddf60c788716252d46058add74a235af116 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Sun, 21 Oct 2001 02:04:27 +0000 Subject: [PATCH] Revert the stacksize work. It's stupid. The original patch from Ben Laurie some years ago was needed because FreeBSD's default stack size was < 8k and this wasn't acceptable. Both Linux and Solaris had reasonable defaults for stacksize, or grew the stack as needed to a reasonable size. Testing today and consulting documentation shows that the default stack sizes on FreeBSD, Linux, and Solaris are all acceptable. Linux can grow to 2MB, 32bit Solaris defaults to 1MB, 64bit Solaris defaults to 2MB, and FreeBSD defaults to 64k. In my opinion FreeBSD needs to get with the program and provide a reasonable default. 64k is enough for us, but might not be for others. svn path=/trunk/thread/; revision=2222 --- thread/thread.c | 9 ++------- thread/thread.h | 6 ++---- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/thread/thread.c b/thread/thread.c index 94387ff..8d64b9d 100644 --- a/thread/thread.c +++ b/thread/thread.c @@ -220,9 +220,8 @@ static void _catch_signals(void) } -long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int stacksize, int detached, int line, char *file) +long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file) { - pthread_attr_t attr; int created; thread_t *thread; thread_start_t *start; @@ -244,17 +243,13 @@ long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int start->thread = thread; start->detached = detached; - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, stacksize); created = 0; - if (pthread_create(&thread->sys_thread, &attr, _start_routine, start) == 0) + if (pthread_create(&thread->sys_thread, NULL, _start_routine, start) == 0) created = 1; else LOG_ERROR("Could not create new thread"); - pthread_attr_destroy(&attr); - if (created == 0) { LOG_ERROR("System won't let me create more threads, giving up"); return -1; diff --git a/thread/thread.h b/thread/thread.h index 33cdbe9..a352265 100644 --- a/thread/thread.h +++ b/thread/thread.h @@ -24,8 +24,6 @@ #include -#define THREAD_DEFAULT_STACKSIZE 8192 - typedef struct thread_tag { /* the local id for the thread, and it's name */ long thread_id; @@ -80,7 +78,7 @@ typedef struct rwlock_tag { pthread_rwlock_t sys_rwlock; } rwlock_t; -#define thread_create(n,w,x,y,z) thread_create_c(n,w,x,y,z,__LINE__,__FILE__) +#define thread_create(n,x,y,z) thread_create_c(n,x,y,z,__LINE__,__FILE__) #define thread_mutex_create(x) thread_mutex_create_c(x,__LINE__,__FILE__) #define thread_mutex_lock(x) thread_mutex_lock_c(x,__LINE__,__FILE__) #define thread_mutex_unlock(x) thread_mutex_unlock_c(x,__LINE__,__FILE__) @@ -106,7 +104,7 @@ void thread_initialize_with_log_id(int log_id); void thread_shutdown(void); /* creation, destruction, locking, unlocking, signalling and waiting */ -long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int stacksize, int detached, int line, char *file); +long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file); void thread_mutex_create_c(mutex_t *mutex, int line, char *file); void thread_mutex_lock_c(mutex_t *mutex, int line, char *file); void thread_mutex_unlock_c(mutex_t *mutex, int line, char *file);