Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions ext/mini_racer_extension/mini_racer_extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ static VALUE rb_mJSON;
static VALUE rb_cFailedV8Conversion;
static VALUE rb_cDateTime = Qnil;

static std::unique_ptr<Platform> current_platform = NULL;
// note: |current_platform| is deliberately leaked on program exit
// because it's not safe to destroy it after main() has exited;
// abnormal termination may have left V8 in an undefined state
static Platform *current_platform;
static std::mutex platform_lock;

static pthread_attr_t *thread_attr_p;
Expand Down Expand Up @@ -366,11 +369,11 @@ static void init_v8() {
if (current_platform == NULL) {
V8::InitializeICU();
if (single_threaded) {
current_platform = platform::NewSingleThreadedDefaultPlatform();
current_platform = platform::NewSingleThreadedDefaultPlatform().release();
} else {
current_platform = platform::NewDefaultPlatform();
current_platform = platform::NewDefaultPlatform().release();
}
V8::InitializePlatform(current_platform.get());
V8::InitializePlatform(current_platform);
V8::Initialize();
}

Expand Down Expand Up @@ -1006,7 +1009,7 @@ static VALUE rb_isolate_pump_message_loop(VALUE self) {

Locker guard { isolate_info->isolate };

if (platform::PumpMessageLoop(current_platform.get(), isolate_info->isolate)){
if (platform::PumpMessageLoop(current_platform, isolate_info->isolate)){
return Qtrue;
} else {
return Qfalse;
Expand Down
Loading