Skip to content

Commit

Permalink
Remove unnecessary mut on R_TEST_LOCK (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- authored Jan 27, 2025
1 parent 8a957a4 commit ef454f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/ark/src/r_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ where
{
// Escape hatch for unit tests
if stdext::IS_TESTING {
let _lock = unsafe { harp::fixtures::R_TEST_LOCK.lock() };
let _lock = harp::fixtures::R_TEST_LOCK.lock();
r_test_init();
return f();
}
Expand Down Expand Up @@ -255,7 +255,7 @@ where
{
// Escape hatch for unit tests
if stdext::IS_TESTING {
let _lock = unsafe { harp::fixtures::R_TEST_LOCK.lock() };
let _lock = harp::fixtures::R_TEST_LOCK.lock();
futures::executor::block_on(fun());
return;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/harp/src/fixtures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::R_MAIN_THREAD_ID;

// FIXME: Needs to be a reentrant lock for idle tasks. We can probably do better
// though.
pub static mut R_TEST_LOCK: parking_lot::ReentrantMutex<()> = parking_lot::ReentrantMutex::new(());
pub static R_TEST_LOCK: parking_lot::ReentrantMutex<()> = parking_lot::ReentrantMutex::new(());

static INIT: Once = Once::new();

Expand All @@ -35,7 +35,7 @@ static INIT: Once = Once::new();
/// `ark::r_task()` in Ark tests so that Ark initialisation also takes place.
#[cfg(test)]
pub(crate) fn r_task<F: FnOnce()>(f: F) {
let guard = unsafe { R_TEST_LOCK.lock() };
let guard = R_TEST_LOCK.lock();

r_test_init();
f();
Expand Down

0 comments on commit ef454f3

Please sign in to comment.