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 sleep(1) before exit call when printing #299

Closed
skliper opened this issue Jul 12, 2021 · 3 comments · Fixed by #301 or #318
Closed

Add sleep(1) before exit call when printing #299

skliper opened this issue Jul 12, 2021 · 3 comments · Fixed by #301 or #318
Labels
enhancement New feature or request

Comments

@skliper
Copy link
Contributor

skliper commented Jul 12, 2021

Is your feature request related to a problem? Please describe.
User reported OS_print doesn't display before exit, for example:

OS_printf("CFE_PSP: Cannot Create CDS Shared memory key!\n");
exit(-1);

Describe the solution you'd like
Add sleep(1) between prints and exits to give it a chance

Describe alternatives you've considered
None

Additional context
None

Requester Info
Jacob Hageman - NASA/GSFC

@skliper skliper added the enhancement New feature or request label Jul 12, 2021
@jphickey
Copy link
Contributor

Similar/related issue to #203 (this is the symptom anyway). I may even have a patch/fix that was never merged for that issue already done somewhere from when I quickly looked at it.

Note that use of sleep system call is discouraged for new code as it may interfere with other timers. nanosleep (POSIX) or even OS_TaskDelay might be preferable.

@jbohren-hbr
Copy link

Would calling fflush(stdout) be adequate here instead of adding a sleep? ref

paulober pushed a commit to paulober/PSP that referenced this issue Aug 29, 2021
@paulober
Copy link
Contributor

Ok, I now used the OS_TaskDelay since it's the implemented behaviour of the OSAL package but maybe I could use fflush(stdout) if someone who knows the project can give a short feedback on this. And if OS_TaskDelay is used maybe only 100 milliseconds are required because this value is already used in:

/*
* This happens if an unhandled exception occurs, or if the user presses CTRL+C
*/
OS_printf("\nCFE_PSP: Shutdown initiated - Exiting cFE\n");
OS_TaskDelay(100);
OS_DeleteAllObjects();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants