Skip to content

Commit fbd8610

Browse files
authored
Use the r_lock! when getting R version info (#25)
* Fix typo * Use the `r_lock!` when getting R version info
1 parent 9d6f482 commit fbd8610

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crates/ark/src/interface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ pub fn listen(exec_recv: Receiver<Request>, prompt_recv: Receiver<String>) {
535535
let mutex = unsafe { KERNEL.as_ref().unwrap() };
536536
{
537537
let mut kernel = mutex.lock().unwrap();
538-
kernel.complete_intialization();
538+
kernel.complete_initialization();
539539
}
540540

541541
loop {

crates/ark/src/kernel.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use crossbeam::channel::Sender;
3131
use harp::exec::RFunction;
3232
use harp::exec::RFunctionExt;
3333
use harp::object::RObject;
34+
use harp::r_lock;
3435
use harp::r_symbol;
3536
use harp::utils::r_is_data_frame;
3637
use libR_sys::*;
@@ -87,9 +88,9 @@ impl Kernel {
8788
}
8889

8990
/// Completes the kernel's initialization
90-
pub fn complete_intialization(&mut self) {
91+
pub fn complete_initialization(&mut self) {
9192
if self.initializing {
92-
let version = unsafe {
93+
let version = r_lock! {
9394
let version = Rf_findVarInFrame(R_BaseNamespace, r_symbol!("R.version.string"));
9495
RObject::new(version).to::<String>().unwrap()
9596
};

0 commit comments

Comments
 (0)