set the pthreads stack size to 128K because FreeBSD's default of 64K
authorNathan Bryant <loanshark@uncensored.citadel.org>
Mon, 17 Dec 2001 08:00:45 +0000 (08:00 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Mon, 17 Dec 2001 08:00:45 +0000 (08:00 +0000)
seems too small. fixes crashes under FreeBSD.

citadel/ChangeLog
citadel/sysdep.c

index 3b6cf47ee585d35bafab53cb3d6bad789d6a4c0e..c6772ebd3b58d8df5ad40e5c3c54fe9e8fb29cd4 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 590.10  2001/12/17 08:00:45  nbryant
+ set the pthreads stack size to 128K because FreeBSD's default of 64K
+ seems too small. fixes crashes under FreeBSD.
+
  Revision 590.9  2001/12/16 00:50:14  error
  * Added usersupp.lastcall to the parameters returned from the PASS/PAS2
    commands in logged_in_response().
@@ -2971,3 +2975,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
+
index 6a565b0a416e64dd4e633e02df4730669227c64e..7e22d927f5b4072bce8631266db56399a9ec03dd 100644 (file)
@@ -769,6 +769,7 @@ struct worker_node *worker_list = NULL;
 void create_worker(void) {
        int ret;
        struct worker_node *n = mallok(sizeof *n);
+       pthread_attr_t attr;
 
        if (n == NULL) {
                lprintf(1, "can't allocate worker_node, exiting\n");
@@ -776,7 +777,22 @@ void create_worker(void) {
                return;
        }
 
-       if ((ret = pthread_create(&n->tid, NULL, worker_thread, NULL) != 0))
+       if ((ret = pthread_attr_init(&attr))) {
+               lprintf(1, "pthread_attr_init: %s\n", strerror(ret));
+               time_to_die = -1;
+               return;
+       }
+
+       /* we seem to need something bigger than
+          FreeBSD's default of 64K of stack. */
+
+       if ((ret = pthread_attr_setstacksize(&attr, 128 * 1024))) {
+               lprintf(1, "pthread_attr_setstacksize: %s\n", strerror(ret));
+               time_to_die = -1;
+               return;
+       }
+
+       if ((ret = pthread_create(&n->tid, &attr, worker_thread, NULL) != 0))
        {
 
                lprintf(1, "Can't create worker thread: %s\n",