From: Skgland Date: Sun, 27 Aug 2023 17:58:08 +0000 (+0200) Subject: add comment why blocking_write is not used X-Git-Tag: remove~112^2~6 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=a95c5e26e683278ee9fc383e95b395da07eb170c;p=scryer-prolog.git add comment why blocking_write is not used --- 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; }