Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Dec 8, 2024
1 parent 4028444 commit 9d58f44
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions itest/rust/src/builtin_tests/containers/callable_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ pub mod custom_callable {
}

// Without this feature, any access to the global binding from another thread fails; so the from_local_fn() cannot be tested in isolation.
// #[cfg(feature = "experimental-threads")]
#[itest]
fn callable_from_local_fn_crossthread() {
// This static is a workaround for not being able to propagate failed `Callable` invocations as panics.
Expand All @@ -212,14 +211,26 @@ pub mod custom_callable {
let crosser = ThreadCrosser::new(callable);

// Create separate thread and ensure calling fails.
// expect_panic(
// "Callable created with from_local_fn() must panic when invoked on other thread",
// ||{
#[cfg(not(feature = "experimental-threads"))]
crate::framework::expect_panic(
"Callable created with from_local_fn() must panic when invoked on other thread",
|| {
quick_thread(|| {
let callable = unsafe { crosser.extract() };
println!("before call");
callable.callv(&varray![5]);
println!("after call");
});
},
);

#[cfg(feature = "experimental-threads")]
quick_thread(|| {
let callable = unsafe { crosser.extract() };
println!("before call");
callable.callv(&varray![5]);
println!("after call");
});
// ,);

// We should really use expect_panic here (AROUND quick_thread, not inside), however we currently can't catch panics, see above.
// Instead, we check the global value.
Expand Down

0 comments on commit 9d58f44

Please sign in to comment.