From 70b6cc8e5536424a04e6631f88117dd3121fc9a9 Mon Sep 17 00:00:00 2001 From: Skgland Date: Sun, 27 Aug 2023 19:56:55 +0200 Subject: [PATCH] fix deadlock in `load_library_as_stream` --- src/machine/system_calls.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 47d203fd..7b017c17 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -7846,7 +7846,9 @@ impl Machine { use crate::machine::LIBRARIES; - match LIBRARIES.borrow().get(&*library_name.as_str()) { + let lib_ref = LIBRARIES.borrow(); + let lib = lib_ref.get(&*library_name.as_str()); + match lib { Some(library) => { let lib_stream = Stream::from_static_string(library, &mut self.machine_st.arena); unify!( -- 2.54.0