freebsd-ports/www/kannel/files/patch-af
Sunpoet Po-Chuan Hsieh 83427aa49f - Eliminate coredump on amd64
- Bump PORTREVISION

PR:		ports/151436
Submitted by:	Dmitry Pryanishnikov <lynx.ripe@gmail.com>
Approved by:	pgollucci (mentor, implicit)
2010-10-16 09:17:20 +00:00

45 lines
1.1 KiB
Text

--- gwlib/gwthread-pthread.c.orig Thu Aug 12 19:53:30 2004
+++ gwlib/gwthread-pthread.c Mon Dec 20 00:53:57 2004
@@ -125,6 +125,11 @@
static pthread_key_t tsd_key;
static pthread_mutex_t threadtable_lock;
+/*
+ * Thread creation parameters.
+ */
+static pthread_attr_t thread_attr;
+#define MIN_THREAD_STACK_SIZE (256 * 1024)
static void lock(void)
{
@@ -263,6 +268,7 @@
{
int ret;
int i;
+ size_t stack_size;
pthread_mutex_init(&threadtable_lock, NULL);
@@ -275,6 +281,13 @@
threadtable[i] = NULL;
}
active_threads = 0;
+/*
+ * Make sure that thread stack is large enough.
+ */
+ pthread_attr_init(&thread_attr);
+ pthread_attr_getstacksize(&thread_attr, &stack_size);
+ if (stack_size < MIN_THREAD_STACK_SIZE)
+ pthread_attr_setstacksize(&thread_attr, MIN_THREAD_STACK_SIZE);
create_threadinfo_main();
}
@@ -443,7 +456,7 @@
return -1;
}
- ret = pthread_create(&id, NULL, &new_thread, p);
+ ret = pthread_create(&id, &thread_attr, &new_thread, p);
if (ret != 0) {
unlock();
error(ret, "Could not create new thread.");