async_hooks: reduce code duplication by using a factory
The difference between the hooks is only a single variable and it can be initialized in the beginning. So I think it's nicer to stick to DRY.
The init
function is also very similar but that would require an additional check, so I kept it as it is.
I also added a TODO
entry as the comment somewhat confused me (ping @trevnorris ).
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
Affected core subsystem(s)
async_hooks