Skip to content

Commit 7324ad5

Browse files
author
Jakub Tymejczyk
committed
Fix GCC/Posix port compilation on FreeBSD (FreeRTOS#1239)
On FreeBSD pthread_once_t is a struct and cast is required. Otherwise there's compilation error: ../../mocks/freertos/port.c:261:23: error: expected expression hSigSetupThread = PTHREAD_ONCE_INIT; ^ PTHREAD_ONCE_INIT is defined as: { PTHREAD_NEEDS_INIT, NULL } on FreeBSD
1 parent ae0a591 commit 7324ad5

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

portable/ThirdParty/GCC/Posix/port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ BaseType_t xPortStartScheduler( void )
303303
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof( hSigSetupThread.__opaque ) );
304304
memset( ( void * ) &hThreadKeyOnce.__opaque, 0, sizeof( hThreadKeyOnce.__opaque ) );
305305
#else /* Linux PTHREAD library*/
306-
hSigSetupThread = PTHREAD_ONCE_INIT;
307-
hThreadKeyOnce = PTHREAD_ONCE_INIT;
306+
hSigSetupThread = ( pthread_once_t ) PTHREAD_ONCE_INIT;
307+
hThreadKeyOnce = ( pthread_once_t ) PTHREAD_ONCE_INIT;
308308
#endif /* __APPLE__*/
309309

310310
/* Restore original signal mask. */

0 commit comments

Comments
 (0)