Shanks0224 opened a new pull request, #22294: URL: https://github.com/apache/nuttx/pull/22294
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary `work_timeleft()` subtracted the current tick from the expiry of the work, so a work that has expired but not run yet, for example while all the workers are busy, gave a negative time left. Its description says that zero means that the work has already started. Return zero once the expiry is reached, and read the clock only once. `work_timeleft()` becomes an inline function; its type and the clock it uses in the kernel and in user space are unchanged. ## Impact `work_timeleft()` no longer returns a negative value. Its only in-tree user, `net/tcp/tcp_timer.c`, compares the result with the timeout it is about to set and requeues the work if they differ, which it still does for an expired work. No impact on the build system, documentation or hardware. ## Testing Build host: Linux x86_64. Regression test: apache/nuttx-apps#APPS_PR (ostest `wqueue_test`: the only worker of a custom queue is kept busy while a second work expires behind it). `sim:nsh` + `CONFIG_TESTING_OSTEST`, ostest, before this PR: ``` wqueue_test: time left wqueue_test: time left of an expired work = -4, expect = 0 dump_assert_info: Current Version: NuttX 13.1.1-RC0 bbc5b51ac85 Nov 25 2026 10:43:17 sim dump_assert_info: Assertion failed left == 0: at file: :0 task: ostest process: ostest 0x400a3e93 ``` With this PR, full ostest: ``` wqueue_test: time left wqueue_test: time left of an expired work = 0, expect = 0 ... ostest_main: Exiting with status 0 ``` `sim:nsh`, `sim:tcpblaster` (which builds `tcp_timer.c`) and `qemu-armv8a:knsh` (`CONFIG_BUILD_KERNEL`, which builds the user space variant) build with no warning. Not tested on real hardware. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
