summaryrefslogtreecommitdiff
path: root/xthread.h
diff options
context:
space:
mode:
authorroot <root>2009-04-22 11:04:49 +0000
committerroot <root>2009-04-22 11:04:49 +0000
commit217dcba927bf9f2ca731fdd9088b3d542d3035b7 (patch)
treefa18eefdfe22d77a9ab7f46ee0488299f6c9ebd1 /xthread.h
parent44c5e91d7894677422bcfe27f68147d8a3353154 (diff)
*** empty log message ***
Diffstat (limited to 'xthread.h')
-rw-r--r--xthread.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/xthread.h b/xthread.h
index e53cb53..88881e8 100644
--- a/xthread.h
+++ b/xthread.h
@@ -118,6 +118,10 @@ typedef pthread_t thread_t;
# define PTHREAD_STACK_MIN 0
#endif
+#ifndef XTHREAD_STACKSIZE
+# define XTHREAD_STACKSIZE sizeof (long) * 4096
+#endif
+
static int
thread_create (thread_t *tid, void *(*proc)(void *), void *arg)
{
@@ -127,8 +131,11 @@ thread_create (thread_t *tid, void *(*proc)(void *), void *arg)
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN < sizeof (long) * 4096
- ? sizeof (long) * 4096 : PTHREAD_STACK_MIN);
+
+ if (XTHREAD_STACKSIZE > 0)
+ pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN > (XTHREAD_STACKSIZE)
+ ? PTHREAD_STACK_MIN : (XTHREAD_STACKSIZE));
+
#ifdef PTHREAD_SCOPE_PROCESS
pthread_attr_setscope (&attr, PTHREAD_SCOPE_PROCESS);
#endif