[xiph-cvs] cvs commit: thread thread.c thread.h
Jack Moffitt
jack at xiph.org
Sat Oct 20 15:27:53 PDT 2001
jack 01/10/20 15:27:52
Modified: . thread.c thread.h
Log:
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.
Revision Changes Path
1.4 +2 -5 thread/thread.c
Index: thread.c
===================================================================
RCS file: /usr/local/cvsroot/thread/thread.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- thread.c 2001/10/20 05:35:30 1.3
+++ thread.c 2001/10/20 22:27:52 1.4
@@ -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 @@
}
-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 @@
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)
1.2 +3 -1 thread/thread.h
Index: thread.h
===================================================================
RCS file: /usr/local/cvsroot/thread/thread.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- thread.h 2001/09/10 02:26:33 1.1
+++ thread.h 2001/10/20 22:27:52 1.2
@@ -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 @@
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__)
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list