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

Stack size per thread needs to be configurable. Setting it on a global

bases is not enough.  ices and icecast need this to be different, and
if one is interested in tuning memory usage, one will want to alter this
per thread.

svn path=/trunk/thread/; revision=2217
This commit is contained in:
Jack Moffitt 2001-10-20 22:27:52 +00:00
parent 5ef3b00332
commit 5a4f095bcd
2 changed files with 5 additions and 6 deletions

View File

@ -56,9 +56,6 @@
#define LOG_DEBUG2(y, z1, z2) log_write(_logid, 4, CATMODULE "/" __FUNCTION__, y, z1, z2)
#define LOG_DEBUG5(y, z1, z2, z3, z4, z5) log_write(_logid, 4, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5)
/* INTERNAL DATA */
#define STACKSIZE 8192
/* thread starting structure */
typedef struct thread_start_tag {
/* the real start routine and arg */
@ -223,7 +220,7 @@ static void _catch_signals(void)
}
long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file)
long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int stacksize, int detached, int line, char *file)
{
pthread_attr_t attr;
int created;
@ -248,7 +245,7 @@ long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int
start->detached = detached;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, STACKSIZE);
pthread_attr_setstacksize(&attr, stacksize);
created = 0;
if (pthread_create(&thread->sys_thread, &attr, _start_routine, start) == 0)

View File

@ -24,6 +24,8 @@
#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;
@ -78,7 +80,7 @@ typedef struct rwlock_tag {
pthread_rwlock_t sys_rwlock;
} rwlock_t;
#define thread_create(n,x,y,z) thread_create_c(n,x,y,z,__LINE__,__FILE__)
#define thread_create(n,w,x,y,z) thread_create_c(n,w,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__)