We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
acquire_r_main()
1 parent aafd634 commit fc087d6Copy full SHA for fc087d6
crates/ark/src/r_task.rs
@@ -110,12 +110,19 @@ impl RTaskMain {
110
111
// Be defensive for the case an auxiliary thread runs a task before R is initialized
112
fn acquire_r_main() -> &'static mut RMain {
113
+ let now = std::time::SystemTime::now();
114
+
115
unsafe {
116
loop {
117
if !R_MAIN.is_none() {
118
return R_MAIN.as_mut().unwrap();
119
}
120
std::thread::sleep(Duration::from_millis(100));
121
122
+ let elapsed = now.elapsed().unwrap().as_secs();
123
+ if elapsed > 50 {
124
+ panic!("Can't acquire main thread");
125
+ }
126
127
128
0 commit comments