Skip to content

Support Event.wait(timeout=...) and Event.clear()#8

Merged
patrick-kidger merged 9 commits intotweaksfrom
timeout
Aug 2, 2025
Merged

Support Event.wait(timeout=...) and Event.clear()#8
patrick-kidger merged 9 commits intotweaksfrom
timeout

Conversation

@patrick-kidger
Copy link
Owner

@patrick-kidger patrick-kidger commented Aug 1, 2025

In particular this makes it possible to express sleeps without needing threads, it all just goes through a single threaidng.Event.wait(timeout=...). As per #7 that seems potentially interesting for WASM builds which do not support threading.

It also definitely makes the user-space implementations of tinyio.sleep and tinyio.timeout more elegant.

For now I'm putting this in a separate branch, much like #7. I need to cook up some far more thorough fuzzing tests before merging either of these, I think, as they are complicated enough that I'm willing to believe I've missed some edge case.

… of the Event.

This is in support of potentially allowing timeouts in the future - we now distinguish specifically which _Wait we might be timing out.
@patrick-kidger patrick-kidger mentioned this pull request Aug 1, 2025
@patrick-kidger patrick-kidger merged commit c6e3da4 into tweaks Aug 2, 2025
1 check passed
@patrick-kidger patrick-kidger deleted the timeout branch August 2, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant