src: trace_events: fix race with metadata events
Multiple threads may be concurrently adding to the metadata_events list. Protect access with a mutex.
Fixes: https://github.com/nodejs/node/issues/24129
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines
CI: https://ci.nodejs.org/job/node-test-pull-request/19827/ https://ci.nodejs.org/job/node-test-pull-request/19975/