Skip to content

Implement CellWakerRegistration #4196

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomkris
Copy link

@tomkris tomkris commented May 14, 2025

embassy_sync::waitqueue::WakerRegistration requires mutable reference for doing register/wake operations.

In some cases there is no mutable reference to WakerRegistration available. This can be worked around by using RefCell<WakerRegistration> which has small runtime and memory overhead.

I'm implementing an alternative CellWakerRegistration which implements interior mutability based on Cell. It provides same functionality, but register/wake functions accept shared &CellWakerRegistration and do not have memory or runtime borrow checking overhead.

@tomkris tomkris force-pushed the cell_waker_registration branch from 99c1a8c to 111e65e Compare May 14, 2025 21:36
`embassy_sync::waitqueue::WakerRegistration` requires mutable reference for doing
register/wake operations.

In some cases there is no mutable reference to `WakerRegistration` available. This can be
worked around by using `RefCell<WakerRegistration>` which has small runtime and memory overhead.

I'm implementing an alternative `CellWakerRegistration` which implements interior mutability
based on `Cell`. It provides same functionality, but `register/wake` functions accept shared
`&CellWakerRegistration` and do not have memory or runtime borrow checking overhead.
@tomkris tomkris force-pushed the cell_waker_registration branch from 111e65e to 4317d4b Compare May 17, 2025 07:33
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