From a95c5e26e683278ee9fc383e95b395da07eb170c Mon Sep 17 00:00:00 2001 From: Skgland Date: Sun, 27 Aug 2023 19:58:08 +0200 Subject: [PATCH] add comment why blocking_write is not used --- src/atom_table.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/atom_table.rs b/src/atom_table.rs index b0042e50..c27773af 100644 --- a/src/atom_table.rs +++ b/src/atom_table.rs @@ -388,6 +388,8 @@ impl AtomTable { pub fn build_with(atom_table: &RwLock, string: &str) -> Atom { let mut atom_table = loop { + // we can't just use blocking_write as tokio's RwLock is fair + // and we can't block readers here as otherwise we will deadlock, see the guard downgrade below if let Ok(guard) = atom_table.try_write() { break guard; } -- 2.54.0