Repository navigation
Add timedWait to ConditionVariable for Haxe 5's Condition - #441
Merged
Merged
Conversation
The Haxe nightly's sys.thread.Condition has timedWait, which calls hx::thread::ConditionVariable's, and libhxcpp had none, so every program that used Condition failed to compile and most of the nightly workflow's jobs failed. timedWait returns true once a signal or broadcast came during the wait and false when the time ran out. NaN, zero and a negative time do not wait, and the wait is capped at 1e9 seconds, which keeps the deadline inside the clock's range, as the Haxe side expects. MSVC's timed waits return no_timeout about half a millisecond before the deadline with nothing signalled, about half the time for a 50 ms wait, so a wakeup counts only when the count of signals moved, and one without waits again. ConditionTimedWait checks a wait that runs out, waits that do not wait, a signal from another thread, and a wait past the cap, with native calls that build with every Haxe.
28 of 34 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Haxe nightly's
sys.thread.Conditionnow hastimedWait, which callshx::thread::ConditionVariable's. libhxcpp had none, so every program that usedConditionfailed to compile with the nightly ('struct hx::thread::ConditionVariable_obj' has no member named 'timedWait'), and most jobs of the nightly workflow failed on it, regression and gc stress builds included.timedWait(seconds)returns true once a signal or broadcast came during the wait and false when the time ran out.no_timeoutabout half a millisecond before the deadline with nothing signalled. Here that happened in 17 of 30 runs of a 50 ms wait. So a wakeup counts only when the count of signals and broadcasts moved, and a wakeup without one waits again until the deadline.ConditionTimedWaitchecks a wait that runs out, the waits that don't wait, a signal from another thread, and a wait past the cap. It calls the runtime from native code, so it builds with every Haxe. Here it matches 40 of 40 runs with Haxe 4.3.7 and passes with the Haxe nightly (5.0.0-preview.1+3cfeac4). A program using the nightly's ownCondition.timedWaitbuilds and runs, and so doesCppiaTimeStampMs, which failed to build in the nightly run.This is Haxe 5 work, so per CONTRIBUTING it isn't a release blocker. It brings the nightly workflow back to testing the API level 500 code.