/*
- * webserver.c
+ * $Id$
*
* This contains a simple multithreaded TCP server manager. It sits around
* waiting on the specified port for incoming HTTP connections. When a
* connection is established, it calls context_loop() from context_loop.c.
*
- * $Id$
*/
#include <ctype.h>
void spawn_another_worker_thread() {
pthread_t SessThread; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
+ int ret;
lprintf(3, "Creating a new thread\n");
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+ /* Our per-thread stacks need to be bigger than the default size, otherwise
+ * the MIME parser crashes on FreeBSD, and the IMAP service crashes on
+ * 64-bit Linux.
+ */
+ if ((ret = pthread_attr_setstacksize(&attr, 1024 * 1024))) {
+ lprintf(1, "pthread_attr_setstacksize: %s\n", strerror(ret));
+ pthread_attr_destroy(&attr);
+ }
+
/* now create the thread */
if (pthread_create(&SessThread, &attr,
(void *(*)(void *)) worker_entry, NULL)