[xiph-cvs] cvs commit: thread thread.c thread.h

Jack Moffitt jack at xiph.org
Sat Oct 20 19:04:28 PDT 2001



jack        01/10/20 19:04:28

  Modified:    .        thread.c thread.h
  Log:
  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.

Revision  Changes    Path
1.5       +2 -7      thread/thread.c

Index: thread.c
===================================================================
RCS file: /usr/local/cvsroot/thread/thread.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- thread.c	2001/10/20 22:27:52	1.4
+++ thread.c	2001/10/21 02:04:27	1.5
@@ -220,9 +220,8 @@
 }
 
 
-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,16 +243,12 @@
         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");

1.4       +2 -4      thread/thread.h

Index: thread.h
===================================================================
RCS file: /usr/local/cvsroot/thread/thread.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- thread.h	2001/10/20 22:40:28	1.3
+++ thread.h	2001/10/21 02:04:27	1.4
@@ -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 @@
         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_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);

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