]> Repositorios git - scryer-prolog.git/commitdiff
add comment why blocking_write is not used
authorSkgland <[email protected]>
Sun, 27 Aug 2023 17:58:08 +0000 (19:58 +0200)
committerBennet Bleßmann <[email protected]>
Tue, 5 Sep 2023 17:12:23 +0000 (19:12 +0200)
src/atom_table.rs

index b0042e50b1e67fdba6bab7249ab7b5bc6e80b1f7..c27773af16982fbf6c0d3d5a82146b5beb7c9208 100644 (file)
@@ -388,6 +388,8 @@ impl AtomTable {
 
     pub fn build_with(atom_table: &RwLock<AtomTable>, 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;
             }