Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Add hal::poll(hal::timeout, polling_function) #23

Open
kammce opened this issue Jun 20, 2022 · 9 comments
Open

Add hal::poll(hal::timeout, polling_function) #23

kammce opened this issue Jun 20, 2022 · 9 comments
Labels
✨ enhancement New feature or request

Comments

@kammce
Copy link
Contributor

kammce commented Jun 20, 2022

Provides a utility that polls a function until it either indicates that it has completed its work or , then the function throws embed::error::timeout, otherwise it returns success.

@SameerAzer
Copy link

I can help with this one

@kammce
Copy link
Contributor Author

kammce commented Jun 28, 2022

Thank you @SameerAzer ! can you type in .take here so you can assign yourself to this issue.

@github-actions
Copy link

Thanks for taking this issue! Let us know if you have any questions!

@kammce kammce assigned SameerAzer and unassigned kammce Jun 28, 2022
@kammce
Copy link
Contributor Author

kammce commented Jun 28, 2022

@SameerAzer actually nvm, I assigned you! Thank you for taking this on!

@kammce kammce changed the title Add embed::poll(timeout, polling_function) Add embed::poll(timeout, polling_function) Jun 29, 2022
@kammce kammce changed the title Add embed::poll(timeout, polling_function) Add embed::poll(embed::timeout, polling_function) Jun 30, 2022
@SameerAzer
Copy link

SameerAzer commented Jul 21, 2022

Does this belong in libembeddedhal/timeout.hpp ? @kammce

@kammce
Copy link
Contributor Author

kammce commented Jul 21, 2022

Yes, it should be in timeout.hpp

@SameerAzer
Copy link

SameerAzer commented Jul 22, 2022

What's polling_function's signature? boost::leaf::result<bool>(void) ??

@kammce
Copy link
Contributor Author

kammce commented Jul 22, 2022

boost::leaf::result<void> type can be used to indicate success or if an error was thrown. embed::poll executes a polling_function until it is either finished, successful poll, or until the timeout times out, return boost::leaf::new_error(embed::error::timeout{}).

I'm not sure when poll would return true/false otherwise.

@kammce
Copy link
Contributor Author

kammce commented Jul 22, 2022

Oh sorry, I misread this. The polling function signature should be boost::leaf::result<bool>(void) where the success value of false means that the polling function has not yet finished its work, true means its work is finished and an error will be transmitted upwards.

@kammce kammce transferred this issue from libhal-google/libhal Dec 11, 2022
@kammce kammce added the ✨ enhancement New feature or request label Dec 11, 2022
@kammce kammce changed the title Add embed::poll(embed::timeout, polling_function) Add hal::poll(embed::timeout, polling_function) Dec 11, 2022
@kammce kammce changed the title Add hal::poll(embed::timeout, polling_function) Add hal::poll(hal::timeout, polling_function) Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants