[wasm] Fix data race when deleting the CompilationState
When resetting the {unique_ptr} to the {CompilationState} in the {NativeModule}, what actually happens is that first the pointer stored in the {unique_ptr} is reset to {nullptr}, then the destructor is called. The destructor of {CompilationState} cancels and waits for background compile jobs. While doing so, background compile jobs still try to access the {unique_ptr} in the {NativeModule}. This CL fixes this race by splitting the shutdown in two steps: First, cancel and wait the background compile jobs, and only later reset the pointer. R=ahaas@chromium.org Bug: v8:8359 No-Tree-Checks: true Change-Id: Ifa3bdf3424dfd5a4712d33f8ca85f9382b1766a6 Reviewed-on: https://chromium-review.googlesource.com/c/1296486 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#56913}
Showing
Please
register
or
sign in
to comment