diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-06-20 14:06:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 16:36:04 +0530 |
commit | 3d6fa64f19e74924813ece5e5fbd53023342bac8 (patch) | |
tree | 9786948872549be0a6e44ab769c04a3d474a7774 /test_ffi/tests/integration_tests.rs | |
parent | 60869c2598321386f57e55537e8c99ed011fbb95 (diff) |
feat(ext/ffi): Callbacks (#14663)
This commit adds support for unstable FFI
callbacks. A callback is registered using
the `Deno.UnsafeCallback` API.
The backing memory for the callback can
be disposed of using `Deno.UnsafeCallback#close`.
It is not safe to pass the callback after calling
close.
Callbacks from other than the isolate thread
are not supported.
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'test_ffi/tests/integration_tests.rs')
-rw-r--r-- | test_ffi/tests/integration_tests.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test_ffi/tests/integration_tests.rs b/test_ffi/tests/integration_tests.rs index 5b9bb2fc2..93f368787 100644 --- a/test_ffi/tests/integration_tests.rs +++ b/test_ffi/tests/integration_tests.rs @@ -65,11 +65,27 @@ fn basic() { -8589934590n\n\ 579.9119873046875\n\ 579.912\n\ + 579\n\ + 8589934590n\n\ + -8589934590n\n\ + 8589934590n\n\ + -8589934590n\n\ + 579.9119873046875\n\ + 579.912\n\ After sleep_blocking\n\ true\n\ Before\n\ true\n\ + logCallback\n\ + 1 -1 2 -2 3 -3 4n -4n 0.5 -0.5 1 2 3 4 5 6 7 8\n\ + u8: 8\n\ + buf: [1, 2, 3, 4, 5, 6, 7, 8]\n\ + logCallback\n\ + 30\n\ + STORED_FUNCTION cleared\n\ + STORED_FUNCTION_2 cleared\n\ Static u32: 42\n\ + Static i64: -1242464576485n\n\ Static ptr: true\n\ Static ptr value: 42\n\ After\n\ |