You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
});
}
}
The text was updated successfully, but these errors were encountered:
theBeardA
changed the title
Lock Guard Drop for tokio
Lock Guard Drop for tokio-compMar 7, 2025
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 thetokio-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.The text was updated successfully, but these errors were encountered: