diff options
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() {} |