fix: enable worker threads (#20416)
This commit is contained in:
parent
3f72f07a7f
commit
9b534e9aab
3 changed files with 31 additions and 52 deletions
29
patches/node/fix_enable_worker_threads.patch
Normal file
29
patches/node/fix_enable_worker_threads.patch
Normal file
|
@ -0,0 +1,29 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 3 Oct 2019 19:03:30 +0200
|
||||
Subject: fix: enable worker_threads
|
||||
|
||||
Electron sets NODE_USE_V8_PLATFORM to false, because Electron
|
||||
initializes the v8 platform itself and Node.js worker thread
|
||||
initialization relies on the platform it uses having been set inside
|
||||
code guarded by NODE_USE_V8_PLATFORM.
|
||||
|
||||
This commit fixes this problem by changing node_worker to use the three-arg
|
||||
implementation of `NewIsolate` to prevent it trying to use a possibly-null ptr.
|
||||
|
||||
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
||||
index 11e44a92757e41e737087c5d08ce9931f0b0fab3..3dce5e25980ce2c6f17cda02dab9c0f8b4fab813 100644
|
||||
--- a/src/node_worker.cc
|
||||
+++ b/src/node_worker.cc
|
||||
@@ -116,7 +116,10 @@ class WorkerThreadData {
|
||||
: w_(w) {
|
||||
CHECK_EQ(uv_loop_init(&loop_), 0);
|
||||
|
||||
- Isolate* isolate = NewIsolate(w->array_buffer_allocator_.get(), &loop_);
|
||||
+ Isolate* isolate = NewIsolate(
|
||||
+ w->array_buffer_allocator_.get(),
|
||||
+ &loop_,
|
||||
+ w->platform_);
|
||||
CHECK_NOT_NULL(isolate);
|
||||
|
||||
{
|
Loading…
Add table
Add a link
Reference in a new issue