apache / apache/celix

Steady thread condition wait for OSX

Open
#587 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
193
Forks
99
Avg merge
1m
Merged PRs (30d)
1

Description

For Linux, the celix functions `celixThreadCondition_waitUntil`, `celixThreadCondition_timedwaitRelative`, `celixThreadCondition_getTime` and `celixThreadCondition_getDelayedTime` are based on a monotonic time to prevent unsteady behavior due to OS sleeps or time updates.
This is possible because the `celixThreadCondition_init` function initializes the underlining thread condition with time MONOTONIC.

For OSX this is not possible.
Currently for OSX a relative sleep is calculated and a call to `pthread_cond_timedwait_relative_np` is used.
Based on test result this seems unsteady, but further investigation is needed. There is also not a lot of documentation for `pthread_cond_timedwait_relative_np`. Does it even return a ETIMEDOUT code?

If this is updated the following test can be reenabled:
ScheduledEventTestSuite, ScheduledEventTimeoutLogTest

And the error margin in ScheduledEventTestSuite and ThreadsTestSuite can be made stricter.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.