diff options
Diffstat (limited to 'test_ffi/src/lib.rs')
-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 b1a210417..c5c2c2d7a 100644 --- a/test_ffi/src/lib.rs +++ b/test_ffi/src/lib.rs @@ -259,6 +259,20 @@ pub extern "C" fn call_stored_function_thread_safe_and_log() { } #[no_mangle] +pub extern "C" fn call_stored_function_2_thread_safe(arg: u8) { + std::thread::spawn(move || { + std::thread::sleep(std::time::Duration::from_millis(1500)); + unsafe { + if STORED_FUNCTION_2.is_none() { + return; + } + println!("Calling"); + STORED_FUNCTION_2.unwrap()(arg); + } + }); +} + +#[no_mangle] pub extern "C" fn log_many_parameters( a: u8, b: u16, |