Skip to content

Commit 4a8daaa

Browse files
committed
Code review suggestions
Signed-off-by: Gaurav Aggarwal <[email protected]>
1 parent f9f0208 commit 4a8daaa

File tree

1 file changed

+2
-17
lines changed
  • portable/ThirdParty/GCC/Posix

1 file changed

+2
-17
lines changed

portable/ThirdParty/GCC/Posix/port.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -165,30 +165,15 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
165165
thread = ( Thread_t * ) ( pxTopOfStack + 1 ) - 1;
166166
pxTopOfStack = ( StackType_t * ) thread - 1;
167167

168+
/* Ensure that there is enough space to store Thread_t on the stack. */
168169
ulStackSize = ( size_t ) ( pxTopOfStack + 1 - pxEndOfStack ) * sizeof( *pxTopOfStack );
169-
170-
#ifdef __APPLE__
171-
/*
172-
* On macOS, pthread_attr_setstacksize requires the stack to be a multiple of the system page size.
173-
* Round up to the next page boundary.
174-
*/
175-
ulStackSize = mach_vm_round_page( ulStackSize );
176-
#endif
170+
configASSERT( ulStackSize > sizeof( Thread_t ) );
177171

178172
thread->pxCode = pxCode;
179173
thread->pvParams = pvParameters;
180174
thread->xDying = pdFALSE;
181175

182-
/* Ensure ulStackSize is at least PTHREAD_STACK_MIN */
183-
ulStackSize = (ulStackSize < ( size_t ) ( PTHREAD_STACK_MIN ) ) ? ( size_t ) ( PTHREAD_STACK_MIN ) : ulStackSize;
184-
185176
pthread_attr_init( &xThreadAttributes );
186-
iRet = pthread_attr_setstacksize( &xThreadAttributes, ulStackSize );
187-
188-
if( iRet != 0 )
189-
{
190-
fprintf( stderr, "[WARN] pthread_attr_setstacksize failed with return value: %d. Default stack size will be used.\n", iRet );
191-
}
192177

193178
thread->ev = event_create();
194179

0 commit comments

Comments
 (0)