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

Add check of sem_wait/rtems_semaphore_obtain in console loop #668

Open
skliper opened this issue Dec 2, 2020 · 1 comment
Open

Add check of sem_wait/rtems_semaphore_obtain in console loop #668

skliper opened this issue Dec 2, 2020 · 1 comment

Comments

@skliper
Copy link
Contributor

skliper commented Dec 2, 2020

Is your feature request related to a problem? Please describe.
Console loop could spin if the semaphore returns error.

Describe the solution you'd like
Check for real errors (not just interrupted), and exit loop if needed.

Describe alternatives you've considered
None.

Additional context
Mentioned in #667

Requester Info
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Jan 4, 2021

Issue only applies to POSIX and RTEMS:

/* Loop forever (unless shutdown is set) */
while (OS_SharedGlobalVars.ShutdownFlag != OS_SHUTDOWN_MAGIC_NUMBER)
{
OS_ConsoleOutput_Impl(&token);
sem_wait(&local->data_sem);
}

while (OS_SharedGlobalVars.ShutdownFlag != OS_SHUTDOWN_MAGIC_NUMBER)
{
OS_ConsoleOutput_Impl(&token);
rtems_semaphore_obtain(local->data_sem, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
}

Already implemented in VxWorks:

while (OS_SharedGlobalVars.ShutdownFlag != OS_SHUTDOWN_MAGIC_NUMBER)
{
OS_ConsoleOutput_Impl(&token);
if (semTake(local->datasem, WAIT_FOREVER) == ERROR)
{
OS_DEBUG("semTake() - vxWorks errno %d\n", errno);
break;
}
}

jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Fix nasa#551, Remove duplicate CFE_TIME_Local1HzISR prototype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant