rtic icon indicating copy to clipboard operation
rtic copied to clipboard

Change `timeout`/`delay` functions to non-async

Open dalegaard opened this issue 1 year ago • 4 comments

Hi,

Because of a compiler bug, the async implementations of delay/delay_until/timeout/timeout_at produce much larger RAM footprint than they should. This was documented in #890.

This patch replaces those implementations with structs with Future implementations instead. On my current project, over three tasks, this saves 488(776->288) bytes over three tasks that used the delay and timeout functionality. As the target has only 8k of RAM, this was a significant saving.

All tests pass, but if someone could take an extra look at the Delay implementation to verify that it is indeed safe, that would be great. I've not done much work with unsafe Rust so it's new territory for me.

Best regards, Lasse

dalegaard avatar Mar 26 '24 18:03 dalegaard

Might have to redo this one after #874 was merged ... :/ sorry for that.

Finomnis avatar Apr 13 '24 14:04 Finomnis

Might have to redo this one after #874 was merged ... :/ sorry for that.

No worries, I've rebased on to latest master and updated.

Best regards, Lasse

dalegaard avatar Jun 20 '24 07:06 dalegaard

Hi @dalegaard, sorry you were hit by a short moment of broken CI! Could you rebase on master again? It should make CI pass for you so we can get this merged :)

korken89 avatar Jun 23 '24 06:06 korken89

@korken89

Certainly, I've rebased it now.

Best regards, Lasse

dalegaard avatar Jun 23 '24 08:06 dalegaard