diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-12-11 20:10:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 03:10:33 +0000 |
commit | a4f45f709278208cb61501df2792412f11aed3c4 (patch) | |
tree | c8e0eaff17141fd5a8097fe2870efb4bca05e431 /test_ffi/src | |
parent | d13e45f2b3e50b85953c31d9c16e35d0cd87545f (diff) |
perf(ext/ffi): switch from middleware to tasks (#21239)
Deno-side changes for https://github.com/denoland/deno_core/pull/350
---------
Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
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 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, |