diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-07-09 12:49:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 11:49:20 +0200 |
commit | 3da182b0b86d93000d4473188f361ffa2de9fb73 (patch) | |
tree | df401be6bbf20e051c25ef18c364278546d737bf /test_ffi/src | |
parent | 20cbd7f0f8f0e0ff4d6656f2fa7e93e01b8805f0 (diff) |
fix(ext/ffi): Avoid keeping JsRuntimeState RefCell borrowed for event loop middleware calls (#15116)
Diffstat (limited to 'test_ffi/src')
-rw-r--r-- | test_ffi/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test_ffi/src/lib.rs b/test_ffi/src/lib.rs index d6f29cbb8..257a47368 100644 --- a/test_ffi/src/lib.rs +++ b/test_ffi/src/lib.rs @@ -224,6 +224,20 @@ pub extern "C" fn call_stored_function_thread_safe() { }); } +#[no_mangle] +pub extern "C" fn call_stored_function_thread_safe_and_log() { + std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_millis(1500)); + unsafe { + if STORED_FUNCTION.is_none() { + return; + } + STORED_FUNCTION.unwrap()(); + println!("STORED_FUNCTION called"); + } + }); +} + // FFI performance helper functions #[no_mangle] pub extern "C" fn nop() {} |