On Tue, Apr 4, 2023 at 10:21 PM Bruce MacNaughton
<bmacnaugh...@gmail.com> wrote:
>
> I've written a node extension that works with private data. I see from the 
> function signature that v8::Isolate::GetCurrent() can return NULL, but I 
> don't understand how that's possible, given that my extension is called by 
> JavaScript and has to be running in an isolate.
>
> The v8::Isolate::Current() function has a DCHECK_NOT_NULL, which I infer 
> means that it shouldn't happen. But I don't know when debug checks would be 
> enabled, so that could be a bad inference.
>
> Does it return NULL in specific circumstances, like startup, thread 
> termination, etc.? Can it return

Yes. :-)

A thread "enters" and "exits" (V8 nomenclature) an isolate. Node
normally enters it and doesn't exit until the thread terminates.

v8::Isolate::TryGetCurrent() exists in case you need to handle the
eventuality of no isolate having been entered.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CAHQurc-2qH14kWqYiXkAk%2BywCPBtwMBYwoMGr%3DVnEdGXuJx%2Brw%40mail.gmail.com.

Reply via email to