Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX Port: Remove pthread_attr_setstacksize call #1161

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions portable/ThirdParty/GCC/Posix/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,30 +165,15 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
thread = ( Thread_t * ) ( pxTopOfStack + 1 ) - 1;
pxTopOfStack = ( StackType_t * ) thread - 1;

#ifdef __APPLE__
pxEndOfStack = ( StackType_t * ) mach_vm_round_page( pxEndOfStack );
#endif

/* Ensure that there is enough space to store Thread_t on the stack. */
ulStackSize = ( size_t ) ( pxTopOfStack + 1 - pxEndOfStack ) * sizeof( *pxTopOfStack );

#ifdef __APPLE__
ulStackSize = mach_vm_trunc_page( ulStackSize );
#endif
configASSERT( ulStackSize > sizeof( Thread_t ) );

thread->pxCode = pxCode;
thread->pvParams = pvParameters;
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 );
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();

Expand Down
Loading