Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hal::time_limit to steady_clock.hpp #11

Open
kammce opened this issue Mar 9, 2024 · 0 comments
Open

Add hal::time_limit to steady_clock.hpp #11

kammce opened this issue Mar 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kammce
Copy link
Member

kammce commented Mar 9, 2024

time_limit is almost exactly like timeout but it doesn't throw an exception. It returns a bool. Timeouts in libhal are categorized as error situations. Such functions should never throw an exception unless a critical time limit has been exceeded. With time_limit the assumption is that the limit being exceeded is apart of the logic and correct behavior. The callable's signature should look like and be compatible with:

using time_limit = bool(void);

Unlike timeout this doesn't need to be a concept. At least not util it is clear that such a construct is in demand. This should be a simple functor or lambda that uses a steady clock in order to determine if a time has expired.

There should also be a delay() api that delays until the remaining time has elapsed.

@kammce kammce added the enhancement New feature or request label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: No status
Development

No branches or pull requests

1 participant