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>
pull/1164/head
Paul Hollinsky 3 months ago committed by GitHub
parent 7081e76f5a
commit 7215c89aa8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save