summaryrefslogtreecommitdiffstats
path: root/cpukit/posix
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-09 14:48:34 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-02-12 09:08:36 +0100
commit01d59443b06ab351039cbc63a688cfa87f196ea0 (patch)
tree2044378caa3adc38cb494405d5618731f3686de2 /cpukit/posix
parentscore: Add _Stack_Extend_size() (diff)
downloadrtems-01d59443b06ab351039cbc63a688cfa87f196ea0.tar.bz2
score: Move thread stack allocation
Move thread stack allocation to caller side of _Thread_Initialize(). Update #3835.
Diffstat (limited to 'cpukit/posix')
-rw-r--r--cpukit/posix/src/pthreadcreate.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 2a418c4b68..1960a4478b 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -120,6 +120,7 @@ int pthread_create(
config.stack_size = _POSIX_Threads_Ensure_minimum_stack(
the_attr->stacksize
);
+ config.stack_size = _Stack_Extend_size( config.stack_size, config.is_fp );
}
#if 0
@@ -215,14 +216,23 @@ int pthread_create(
return EAGAIN;
}
+ if ( config.stack_area == NULL ) {
+ config.stack_area = _Stack_Allocate( config.stack_size );
+ config.allocated_stack = config.stack_area;
+ }
+
+ status = ( config.stack_area != NULL );
+
/*
* Initialize the core thread for this task.
*/
- status = _Thread_Initialize(
- &_POSIX_Threads_Information,
- the_thread,
- &config
- );
+ if ( status ) {
+ status = _Thread_Initialize(
+ &_POSIX_Threads_Information,
+ the_thread,
+ &config
+ );
+ }
if ( !status ) {
_POSIX_Threads_Free( the_thread );
_Objects_Allocator_unlock();