mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -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:
parent
42e869cd45
commit
1902634e50
@ -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;
|
int created;
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
thread_start_t *start;
|
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->thread = thread;
|
||||||
start->detached = detached;
|
start->detached = detached;
|
||||||
|
|
||||||
pthread_attr_init(&attr);
|
|
||||||
pthread_attr_setstacksize(&attr, stacksize);
|
|
||||||
|
|
||||||
created = 0;
|
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;
|
created = 1;
|
||||||
else
|
else
|
||||||
LOG_ERROR("Could not create new thread");
|
LOG_ERROR("Could not create new thread");
|
||||||
|
|
||||||
pthread_attr_destroy(&attr);
|
|
||||||
|
|
||||||
if (created == 0) {
|
if (created == 0) {
|
||||||
LOG_ERROR("System won't let me create more threads, giving up");
|
LOG_ERROR("System won't let me create more threads, giving up");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#define THREAD_DEFAULT_STACKSIZE 8192
|
|
||||||
|
|
||||||
typedef struct thread_tag {
|
typedef struct thread_tag {
|
||||||
/* the local id for the thread, and it's name */
|
/* the local id for the thread, and it's name */
|
||||||
long thread_id;
|
long thread_id;
|
||||||
@ -80,7 +78,7 @@ typedef struct rwlock_tag {
|
|||||||
pthread_rwlock_t sys_rwlock;
|
pthread_rwlock_t sys_rwlock;
|
||||||
} rwlock_t;
|
} 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_create(x) thread_mutex_create_c(x,__LINE__,__FILE__)
|
||||||
#define thread_mutex_lock(x) thread_mutex_lock_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__)
|
#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);
|
void thread_shutdown(void);
|
||||||
|
|
||||||
/* creation, destruction, locking, unlocking, signalling and waiting */
|
/* 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_create_c(mutex_t *mutex, int line, char *file);
|
||||||
void thread_mutex_lock_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);
|
void thread_mutex_unlock_c(mutex_t *mutex, int line, char *file);
|
||||||
|
Loading…
Reference in New Issue
Block a user