Repository navigation
testing/ostest, benchmarks/cyclictest: Prepare for the PSE52 pthread fixes. - #4049
Merged
Merged
Conversation
restart_thread() destroys the condition variable after the waiter thread was cancelled. A thread that is cancelled while it waits in pthread_cond_wait() stays counted as a waiter, so pthread_cond_destroy() fails with EBUSY once it checks for waiters. Broadcast the condition before it is destroyed, so that no waiter is counted any more. Also fix the nxstyle errors and a typo in the file. Assisted-by: Kiro:auto Signed-off-by: ganjing <ganjing@xiaomi.com>
The -c option takes 0 for CLOCK_REALTIME and 1 for CLOCK_MONOTONIC, but the code used the number as the clock ID, which only works while the clock IDs have these values. Map 0 and 1 to the clock names. Also fix the nxstyle errors in the file. Assisted-by: Kiro:auto Signed-off-by: ganjing <ganjing@xiaomi.com>
xiaoxiang781216
approved these changes
Nov 13, 2026
acassis
approved these changes
Nov 13, 2026
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.
Note: Please adhere to Contributing Guidelines.
Summary
Two changes that the PSE52 conformance fixes in apache/nuttx need:
waiter was cancelled. With the nuttx change,
pthread_cond_destroy()returns EBUSY while a thread is counted as a waiter, so broadcast the
condition before it is destroyed.
-coption used the number from the user asthe clock ID. Map 0 and 1 to
CLOCK_REALTIMEandCLOCK_MONOTONIC, asthe help text and the documentation say, so that the option keeps
working when the clock ID values change.
Both commits also fix the nxstyle errors in the files that they touch.
Related: apache/nuttx#21834
Impact
None for users. Both changes also work with the current nuttx, so this PR
can be merged first.
Testing
ostest,
sim:ostest, 5 loops: passes with the current nuttx master,and with the nuttx PR above. With the nuttx PR it also passes on
qemu-armv7r:pnsh,qemu-armv7a:knshand a B-L475E-IOT01A board(
b-l475e-iot01a:nshwithCONFIG_TESTING_OSTEST=y). The cancel testwith the nuttx PR:
cyclictest,
sim:nshwithCONFIG_TIMER=yandCONFIG_BENCHMARK_CYCLICTEST=y:cyclictest -c 0 -l 200andcyclictest -c 1 -l 200run with the current nuttx master and with thenuttx PR:
The output does not show which clock is used.