We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ab04b7 commit 7d0ebebCopy full SHA for 7d0ebeb
crates/harp/src/test.rs
@@ -15,6 +15,7 @@
15
16
use std::os::raw::c_char;
17
use std::process::Command;
18
+use std::sync::Mutex;
19
use std::sync::Once;
20
21
use libR_sys::*;
@@ -62,10 +63,14 @@ pub fn start_r() {
62
63
});
64
}
65
-// FIXME: Actually run `f` and fix thread safety in tests
66
+static mut R_RUNTIME_LOCK: Mutex<()> = Mutex::new(());
67
+
68
pub fn r_test_impl<F: FnMut()>(f: F) {
69
start_r();
- r_safely(|| f);
70
71
+ let guard = unsafe { R_RUNTIME_LOCK.lock() };
72
+ r_safely(f);
73
+ drop(guard);
74
75
76
#[macro_export]
0 commit comments