-
Notifications
You must be signed in to change notification settings - Fork 240
We should firm up the semantics of userlib::sleep* #206
Copy link
Copy link
Open
Labels
Triaged H2'26This issue or pull request has been triaged in the later half of 2026 as still relevant.This issue or pull request has been triaged in the later half of 2026 as still relevant.developer-experienceFixing this would have a positive impact on developer experienceFixing this would have a positive impact on developer experienceuserlibRelated to userlib, the fundamental library used by tasksRelated to userlib, the fundamental library used by tasks
Description
Activity
Metadata
Metadata
Assignees
Labels
Triaged H2'26This issue or pull request has been triaged in the later half of 2026 as still relevant.This issue or pull request has been triaged in the later half of 2026 as still relevant.developer-experienceFixing this would have a positive impact on developer experienceFixing this would have a positive impact on developer experienceuserlibRelated to userlib, the fundamental library used by tasksRelated to userlib, the fundamental library used by tasks
So, we've kind of avoided dealing with the timebase problem. (Well, okay, mostly me.)
Currently we express time in all APIs as "system ticks," where the system tick is set for the application (board+image) to whatever you want .... but in practice is milliseconds. And basically all code assumes it's milliseconds.
There are two problems with this.
userlibtime-related APIs don't actually do what you'd expect.On that second point -- if you call
sleep_for(1), you will (in the absence of higher priority tasks keeping you from being scheduled at all) sleep for somewhere between 0ms and 1ms. In other words, it's reallysleep_for_at_most_ms. Often, we actually want at least.The actual kernel time API is based on absolute deadlines rather than intervals (basically to keep the kernel out of this argument) so I think we could fix this part in userlib.