Add feature for unix systems that toggles sleep function used - #1185
Open
mayushiiii wants to merge 1 commit into
Open
Add feature for unix systems that toggles sleep function used#1185mayushiiii wants to merge 1 commit into
mayushiiii wants to merge 1 commit into
Conversation
mayushiiii
marked this pull request as draft
March 13, 2026 14:42
mayushiiii
marked this pull request as ready for review
March 13, 2026 14:53
mayushiiii
force-pushed
the
add_sleep_toggle
branch
3 times, most recently
from
March 16, 2026 14:56
62da8be to
bc3a229
Compare
|
|
||
| z_result_t z_sleep_ms(size_t time) { | ||
| #if Z_FEATURE_EFFICIENT_SLEEP | ||
| z_result_t ret = z_sleep_us(time * 1000); |
Check warning
Code scanning / Cppcheck (reported by Codacy)
time is Y2038-unsafe
mayushiiii
force-pushed
the
add_sleep_toggle
branch
from
March 17, 2026 13:22
8e657d4 to
bfb31bd
Compare
This change adds a flag that changes the z_sleep_ms function that is used on Unix-based systems so as to decrease overhead.
mayushiiii
force-pushed
the
add_sleep_toggle
branch
from
March 17, 2026 13:26
bfb31bd to
10dee55
Compare
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.
Description
Added a flag for changing the sleep function that is used on unix-based systems in order to increase efficiency.
What does this PR do?
As of right now, the z_sleep_ms function leads to an increased CPU usage, as it has multiple syscalls. The addition of the flag determines which sleep function is used depending on the user's needs. This will allow to decrease the CPU usage for systems where oversleep is not that big of a problem and is more acceptable than a high CPU usage.
Note: I'm sorry since I haven't done this before, but I'm not sure how to add a label to the PR. Seems to be a permission problem.
🏷️ Label-Based Checklist
Based on the labels applied to this PR, please complete these additional requirements:
Labels:
enhancement,good first issue✨ Enhancement Requirements
Since this PR enhances existing functionality:
Remember: Enhancements should not introduce new APIs or breaking changes.
Instructions:
- [ ]to- [x])This checklist updates automatically when labels change, but preserves your checked boxes.