From 01d59443b06ab351039cbc63a688cfa87f196ea0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 9 Dec 2019 14:48:34 +0100 Subject: score: Move thread stack allocation Move thread stack allocation to caller side of _Thread_Initialize(). Update #3835. --- cpukit/posix/src/pthreadcreate.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'cpukit/posix/src/pthreadcreate.c') 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(); -- cgit v1.2.3