1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00
denoland-deno/test_ffi/tests
Aapo Alasuutari 75acec0aea
fix(ext/ffi): Fix UnsafeCallback ref'ing making Deno enter a live-loop (#16216)
Fixes #15136

Currently `UnsafeCallback` class' `ref()` and `unref()` methods rely on
the `event_loop_middleware` implementation in core. If even a single
`UnsafeCallback` is ref'ed, then the FFI event loop middleware will
always return `true` to signify that there may still be more work for
the event loop to do.

The middleware handling in core does not wait a moment to check again,
but will instead synchronously directly re-poll the event loop and
middlewares for more work. This becomes a live-loop.

This PR introduces a `Future` implementation for the `CallbackInfo`
struct that acts as the intermediary data storage between an
`UnsafeCallback` and the `libffi` C callback. Ref'ing a callback now
means calling an async op that binds to the `CallbackInfo` Future and
only resolves once the callback is unref'ed. The `libffi` C callback
will call the waker of this Future when it fires to make sure that the
main thread wakes up to receive the callback.
2022-10-15 19:19:46 +05:30
..
bench.js feat(ext/ffi): Support bool FFI type (#15754) 2022-09-05 08:56:52 +05:30
event_loop_integration.ts fix(ext/ffi): Avoid keeping JsRuntimeState RefCell borrowed for event loop middleware calls (#15116) 2022-07-09 11:49:20 +02:00
ffi_types.ts feat(ext/ffi): Support bool FFI type (#15754) 2022-09-05 08:56:52 +05:30
integration_tests.rs feat(ext/ffi): Implement FFI fast-call trampoline with Dynasmrt (#15305) 2022-09-07 12:23:56 +05:30
test.js fix(ext/ffi): Fix UnsafeCallback ref'ing making Deno enter a live-loop (#16216) 2022-10-15 19:19:46 +05:30
thread_safe_test.js feat(ext/ffi): Thread safe callbacks (#14942) 2022-06-28 14:53:36 +05:30
thread_safe_test_worker.js feat(ext/ffi): Thread safe callbacks (#14942) 2022-06-28 14:53:36 +05:30