Closed
Description
I was implementing my own lock manager when i came across this library. since my code base is based on tokio and I dont want to bring in async-std, I was wondering if Drop
implementation for the tokio-comp
feature using conditional compile is the way to go? I might be missing something, but from my initial experiments, this approach appears to work for Drop.
#[cfg(feature = "tokio-comp")]
impl Drop for LockGuard {
fn drop(&mut self) {
let lock = self.lock.clone();
let lock_manager = self.lock.lock_manager.clone();
tokio::spawn(async move {
let _ = lock_manager.unlock(&lock).await;
});
}
}
Metadata
Metadata
Assignees
Labels
No labels