flashmap icon indicating copy to clipboard operation
flashmap copied to clipboard

Add async support

Open Cassy343 opened this issue 3 years ago • 1 comments

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 avatar Aug 02 '22 14:08 Cassy343

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

Cassy343 avatar Aug 02 '22 17:08 Cassy343