summaryrefslogtreecommitdiff
path: root/common_modules/module_lib/src/txm_timer_create.c
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2026-08-20 08:50:15 -0400
committerGitHub <[email protected]>2026-08-20 08:50:15 -0400
commita5483f0773d5b2a15b5247b4f0fbd72a0c7a8750 (patch)
tree9e49ea8dbbb7914e633f171892aa3c7b7831fdb7 /common_modules/module_lib/src/txm_timer_create.c
parent4d9ce418451cca88851c8e255a3bbb3703ad47ab (diff)
Bounded the wait for the delayed suspension window (#645)
threadx_thread_delayed_suspension_test waits for an interrupt to land while thread 2 is part way through suspending, and waits for it with no bound: while(delayed_suspend_set == 0) { tx_thread_wait_abort(&thread_2); tx_thread_relinquish(); } How long that takes depends on the build to a degree that is easy to miss. The loop finishes in between a tenth of a second and three seconds in four of the five ThreadX configurations. In trace_build it took 490 seconds, which was 40 percent of the whole ThreadX suite and more than every other test in that configuration put together. This is the third test in these suites built the same way, after threadx_thread_priority_change and threadx_thread_wait_abort_and_isr_test: spin until an interrupt happens to land in a narrow window, with nothing to stop the spin if it does not. The other two have been given bounds already. Give this one a wall clock budget too, for the same reason as the last: a tick is delivered only when the port's timer thread runs, so the tick clock falls behind real time under load or instrumentation, and instrumentation is exactly what trace_build turns on. The check after the loop needs care that the other two did not. It compares thread_2_counter against thread_2_counter_capture, and the capture is taken inside the interrupt handler at the moment the window is hit. Leaving that check in place after a run that never reached the window would compare a live counter against the zero it was initialised to and report a defect that is not there. So the check is skipped when the window was not reached, and the run says so. Reaching the window still exercises it exactly as before. Verified both ways in trace_build, which is the configuration that was slow: the window is reached in 8 seconds here and the test passes as it always did, and with the budget forced to zero the test reports that the window was not reached and passes without the dependent check firing. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Diffstat (limited to 'common_modules/module_lib/src/txm_timer_create.c')
0 files changed, 0 insertions, 0 deletions