Skip to content

Fix MacOS Posix port #957

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

Merged
merged 10 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion .github/workflows/kernel-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ jobs:

POSIX-GCC:
name: Native GCC
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the FreeRTOS/FreeRTOS Repository
uses: actions/checkout@v3
Expand All @@ -83,6 +89,7 @@ jobs:

- name: Install GCC
shell: bash
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get -y update
sudo apt-get -y install build-essential
Expand Down
14 changes: 10 additions & 4 deletions portable/ThirdParty/GCC/Posix/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

#include <errno.h>
#include <pthread.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -281,10 +282,15 @@ BaseType_t xPortStartScheduler( void )
*/
xSchedulerEnd = pdFALSE;

/* Reset the pthread_once_t structure. This is required if the port
* starts the scheduler again. */
hSigSetupThread = PTHREAD_ONCE_INIT;

/* Reset pthread_once_t, needed to restart the scheduler again.
* memset the internal struct members for MacOS/Linux Compatability */
#if __APPLE__
hSigSetupThread.__sig = _PTHREAD_ONCE_SIG_init;
memset( ( void * ) &hSigSetupThread.__opaque, 0, sizeof(hSigSetupThread.__opaque));
#else /* Linux PTHREAD library*/
hSigSetupThread = PTHREAD_ONCE_INIT;
#endif /* __APPLE__*/

/* Restore original signal mask. */
( void ) pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );

Expand Down