summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/pthreadcreate.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-06-13 15:06:32 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-06-13 15:06:32 +0000
commitecf0f4c4c18956576aeb69372b93910af7ca37e9 (patch)
treebdc81902ff221b497c67e31822a08dbd69b69a40 /cpukit/posix/src/pthreadcreate.c
parent2008-06-10 Chris Johns <chrisj@rtems.org> (diff)
downloadrtems-ecf0f4c4c18956576aeb69372b93910af7ca37e9.tar.bz2
2008-06-13 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/include/rtems/posix/pthread.h, posix/src/pthread.c, posix/src/pthreadcreate.c, rtems/include/rtems.h, rtems/src/attr.c, sapi/include/confdefs.h, sapi/include/rtems/config.h, score/inline/rtems/score/stack.inl, score/src/isr.c, score/src/mpci.c, score/src/threadcreateidle.c, score/src/threadinitialize.c, score/src/threadstackallocate.c: Add ability for application to configure minimum stack size. Add RTEMS_CONFIGURED_MINIMUM_STACK_SIZE constant so user can clearly indicate they want the configured as opposed to the recommended minimum stack size.
Diffstat (limited to 'cpukit/posix/src/pthreadcreate.c')
-rw-r--r--cpukit/posix/src/pthreadcreate.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 6eeda2da14..c579fb3e14 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -26,6 +26,16 @@
#include <rtems/posix/time.h>
#include <rtems/score/apimutex.h>
+static inline size_t _POSIX_Threads_Ensure_minimum_stack (
+ size_t size
+)
+{
+ if ( size >= PTHREAD_MINIMUM_STACK_SIZE )
+ return size;
+ return PTHREAD_MINIMUM_STACK_SIZE;
+}
+
+
int pthread_create(
pthread_t *thread,
const pthread_attr_t *attr,
@@ -54,11 +64,13 @@ int pthread_create(
return EINVAL;
/*
- * Core Thread Initialize insures we get the minimum amount of
+ * Core Thread Initialize ensures we get the minimum amount of
* stack space if it is allowed to allocate it itself.
+ *
+ * NOTE: If the user provides the stack we will let it drop below
+ * twice the minimum.
*/
-
- if ( the_attr->stackaddr && !_Stack_Is_enough( the_attr->stacksize ) )
+ if ( the_attr->stackaddr && !_Stack_Is_enough(the_attr->stacksize) )
return EINVAL;
#if 0
@@ -184,7 +196,7 @@ int pthread_create(
&_POSIX_Threads_Information,
the_thread,
the_attr->stackaddr,
- the_attr->stacksize,
+ _POSIX_Threads_Ensure_minimum_stack(the_attr->stacksize),
is_fp,
core_priority,
TRUE, /* preemptible */