mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
POSIX Port: Remove pthread_attr_setstacksize call (#1161)
We have removed the use of pthread_attr_setstack and as a result, the task stack is no longer used as the corresponding pthread's stack. There is no use of calling pthread_attr_setstacksize as the default is always good enough and we don't need to handle OS specific cases. This PR simplifies the code by removing the call to pthread_attr_setstacksize. Signed-off-by: Paul Hollinsky <paulhollinsky@gmail.com>
This commit is contained in:
parent
7081e76f5a
commit
7215c89aa8
19
portable/ThirdParty/GCC/Posix/port.c
vendored
19
portable/ThirdParty/GCC/Posix/port.c
vendored
|
@ -165,30 +165,15 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||||
thread = ( Thread_t * ) ( pxTopOfStack + 1 ) - 1;
|
thread = ( Thread_t * ) ( pxTopOfStack + 1 ) - 1;
|
||||||
pxTopOfStack = ( StackType_t * ) thread - 1;
|
pxTopOfStack = ( StackType_t * ) thread - 1;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
/* Ensure that there is enough space to store Thread_t on the stack. */
|
||||||
pxEndOfStack = ( StackType_t * ) mach_vm_round_page( pxEndOfStack );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ulStackSize = ( size_t ) ( pxTopOfStack + 1 - pxEndOfStack ) * sizeof( *pxTopOfStack );
|
ulStackSize = ( size_t ) ( pxTopOfStack + 1 - pxEndOfStack ) * sizeof( *pxTopOfStack );
|
||||||
|
configASSERT( ulStackSize > sizeof( Thread_t ) );
|
||||||
#ifdef __APPLE__
|
|
||||||
ulStackSize = mach_vm_trunc_page( ulStackSize );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
thread->pxCode = pxCode;
|
thread->pxCode = pxCode;
|
||||||
thread->pvParams = pvParameters;
|
thread->pvParams = pvParameters;
|
||||||
thread->xDying = pdFALSE;
|
thread->xDying = pdFALSE;
|
||||||
|
|
||||||
/* Ensure ulStackSize is at least PTHREAD_STACK_MIN */
|
|
||||||
ulStackSize = (ulStackSize < ( size_t ) ( PTHREAD_STACK_MIN ) ) ? ( size_t ) ( PTHREAD_STACK_MIN ) : ulStackSize;
|
|
||||||
|
|
||||||
pthread_attr_init( &xThreadAttributes );
|
pthread_attr_init( &xThreadAttributes );
|
||||||
iRet = pthread_attr_setstacksize( &xThreadAttributes, ulStackSize );
|
|
||||||
|
|
||||||
if( iRet != 0 )
|
|
||||||
{
|
|
||||||
fprintf( stderr, "[WARN] pthread_attr_setstacksize failed with return value: %d. Default stack size will be used.\n", iRet );
|
|
||||||
}
|
|
||||||
|
|
||||||
thread->ev = event_create();
|
thread->ev = event_create();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue