async_hooks: add AsyncResource.bind utility
Creates an internal AsyncResource and binds a function to it, ensuring that the function is invoked within execution context in which bind was called.
This is suggested as a solution for #33723 (closed) and is a simple utility over what can already be done with AsyncResource
.
/cc @addaleax @puzpuzpuz @ronag @Qard @devsnek @targos
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines