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 async support #4

Open
Cassy343 opened this issue Aug 2, 2022 · 1 comment
Open

Add async support #4

Cassy343 opened this issue Aug 2, 2022 · 1 comment
Assignees

Comments

@Cassy343
Copy link
Owner

Cassy343 commented Aug 2, 2022

The only blocking operation in this entire crate is the synchronize method on Core. This should be able to to be readily converted into a future.

This different API could then be exposed through an AsyncWriteHandle type. This type could offload most of its work by forwarding methods on the sync WriteHandle.

One issue to consider is that the WriteHandle currently calls this method on drop. This is not acceptable in an async context and could cause a deadlock. This could likely be solved by offloading the work done there on drop to be done when the Core is dropped. An easy hack for this would be to add a Box<dyn FnOnce(&Self)> to Core called on drop when the async feature is enabled.

@Cassy343 Cassy343 self-assigned this Aug 2, 2022
@Cassy343
Copy link
Owner Author

Cassy343 commented Aug 2, 2022

I'll be doing work to this effect on branch feature/async. It'll probably take a bit to add sufficient tests.

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

No branches or pull requests

1 participant