Commit 62384d67 authored by Jack Moffitt's avatar Jack Moffitt

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
parent e8803052
......@@ -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)
......
......@@ -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__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment