1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

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
This commit is contained in:
Jack Moffitt 2001-10-21 02:04:27 +00:00
parent 951996a8c5
commit 0f3efddf60
2 changed files with 4 additions and 11 deletions

View File

@ -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;

View File

@ -24,8 +24,6 @@
#include <pthread.h>
#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);