From e86027bb3e1b6974c22553eebdc616711a68cce7 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Fri, 4 Oct 2024 15:17:12 +0200 Subject: [PATCH] Move `r_task()` initialization after R was set up --- crates/ark/src/interface.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ark/src/interface.rs b/crates/ark/src/interface.rs index 707760e18..86ac1ce90 100644 --- a/crates/ark/src/interface.rs +++ b/crates/ark/src/interface.rs @@ -311,8 +311,6 @@ impl RMain { let (tasks_interrupt_tx, tasks_interrupt_rx) = unbounded::(); let (tasks_idle_tx, tasks_idle_rx) = unbounded::(); - r_task::initialize(tasks_interrupt_tx.clone(), tasks_idle_tx.clone()); - unsafe { R_MAIN = Some(RMain::new( kernel_mutex, @@ -416,6 +414,9 @@ impl RMain { // Set up the global error handler (after support function initialization) errors::initialize(); + // Now allow interrupt-time tasks to run + r_task::initialize(tasks_interrupt_tx.clone(), tasks_idle_tx.clone()); + // Now that R has started (emitting any startup messages), and now that we have set // up all hooks and handlers, officially finish the R initialization process to // unblock the kernel-info request and also allow the LSP to start.