summaryrefslogtreecommitdiff
path: root/test_ffi/src
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2021-10-05 18:20:00 +0530
committerGitHub <noreply@github.com>2021-10-05 14:50:00 +0200
commit80aee99c9e2eba879a0981235bee740088c6fbad (patch)
tree68fd3a256b1900f141c105b1ab051eded2e95a6c /test_ffi/src
parentf1d3a170430501b4fab1a2d2abb5d77528251c77 (diff)
feat(ext/ffi): Non-blocking FFI (#12274)
Diffstat (limited to 'test_ffi/src')
-rw-r--r--test_ffi/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/test_ffi/src/lib.rs b/test_ffi/src/lib.rs
index a5a077950..c91d05e05 100644
--- a/test_ffi/src/lib.rs
+++ b/test_ffi/src/lib.rs
@@ -1,3 +1,6 @@
+use std::thread::sleep;
+use std::time::Duration;
+
#[no_mangle]
pub extern "C" fn print_something() {
println!("something");
@@ -42,3 +45,9 @@ pub extern "C" fn add_f32(a: f32, b: f32) -> f32 {
pub extern "C" fn add_f64(a: f64, b: f64) -> f64 {
a + b
}
+
+#[no_mangle]
+pub extern "C" fn sleep_blocking(ms: u64) {
+ let duration = Duration::from_millis(ms);
+ sleep(duration);
+}