Skip to content

Commit

Permalink
Fix GCC/Posix port compilation on FreeBSD (FreeRTOS#1239) (FreeRTOS#1240
Browse files Browse the repository at this point in the history
)

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

Co-authored-by: Jakub Tymejczyk <[email protected]>
  • Loading branch information
tymmej and Jakub Tymejczyk authored Feb 7, 2025
1 parent ae0a591 commit d10ee46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions portable/ThirdParty/GCC/Posix/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ BaseType_t xPortStartScheduler( void )
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof( hSigSetupThread.__opaque ) );
memset( ( void * ) &hThreadKeyOnce.__opaque, 0, sizeof( hThreadKeyOnce.__opaque ) );
#else /* Linux PTHREAD library*/
hSigSetupThread = PTHREAD_ONCE_INIT;
hThreadKeyOnce = PTHREAD_ONCE_INIT;
hSigSetupThread = ( pthread_once_t ) PTHREAD_ONCE_INIT;
hThreadKeyOnce = ( pthread_once_t ) PTHREAD_ONCE_INIT;
#endif /* __APPLE__*/

/* Restore original signal mask. */
Expand Down

0 comments on commit d10ee46

Please sign in to comment.