-
Notifications
You must be signed in to change notification settings - Fork 241
Fix nasa#1401, make OS_QueueGet timeouts monotonic. #1514
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
base: main
Are you sure you want to change the base?
Fix nasa#1401, make OS_QueueGet timeouts monotonic. #1514
Conversation
mq_timedreceive_monotonic() is not in the POSIX standard. Per what I found on the Net, it is specific to QNX and not supported on Linux, FreeBSD, or RTEMS. Per the POSIX Issue 8 definition of mqueue.h, message queues do not include a function similar to pthread_mutex_clocklock() which lets you specify the clock. poll() is similar to select() in that there it should not be assumed that it will work on anything other than sockets when dealing with an RTOS TCP/IP stack. |
Hi @joelsherrill I apologize. Yes, I will review your feedback and make proper changes to the proposed solution to check if it remains viable. Thank you for your response. I'm changing this PR to draft. |
Since the name looks like POSIX function, you need to at least add the suffix of "_np" for non-portable. But since it is provided outside of the OS and libraries, I'd recommend using another name entirely. What does the implementation of that function depend on? |
Hi Joel. Function is now purely internal and no longer exposed in os-posix.h. It depends on:
The helper is now a I’ll continue testing this PR for further improvements. |
Checklist
Describe the contribution
Fixes #1401. Make
OS_QueueGet
finite timeouts immune toCLOCK_REALTIME
changes in OSAL POSIX by:OS_Posix_CompAbsDelayTimeMonotonic()
andmq_timedreceive_monotonic()
(usesCLOCK_MONOTONIC
+poll
).mq_timedreceive_monotonic()
is a new method I implemented to try to fix the issue.CLOCK_REALTIME
forward to test and validate behavior.Testing performed
queue-test
.sudo ./queue-test
clock_settime
+10 seconds every 5 seconds) whileOS_QueueGet
continues to timeout ~every 1s.All tests PASS:
TOTAL::43 PASS::43 FAIL::0
.Expected behavior changes
OS_QueueGet
with a finite timeout is now based on monotonic time; unaffected by wall-clock jumps (settimeofday
).OS_PEND
andOS_CHECK
semantics unchanged.System(s) tested on
Additional context
clock_settime(CLOCK_REALTIME, …)
to simulate wall-clock discontinuities.Third party code
None.
Contributor Info - All information REQUIRED for consideration of pull request
Franco Chiesa Docampo - Personal.