That makes sense, and I was pretty sure that just creating a new isolate was
clearly not the way to go. Since I'm dealing with Persistent objects, what 
I do, then? I read somewhere that if Isolate::GetCurrent() returned NULL, 
it was
because the current isolate was being already used, I guess by the running
node.js itself?

If so, I really need assistance, because I technically can't stop it 
(because other
modules are running on it and some are time-sensitive), and even if I 
could, I don't
see how I'd do that.

I can't test your suggestions right now but will try tomorrow and make a 

Thanks a lot!

On Thursday, December 1, 2016 at 8:34:41 PM UTC+1, Ben Noordhuis wrote:
> On Thu, Dec 1, 2016 at 5:09 PM, Thomas Barusseau 
> <baruss...@gmail.com <javascript:>> wrote: 
> > Hello, 
> > 
> > I'm having a hard time making this piece of code work. Basically, I need 
> to 
> > take a node.js function (in this case : `process.emit()`), 
> > store it in a C++ class, and use it at runtime whenever a callback 
> method is 
> > called. 
> > 
> > Here is the code : 
> > https://gist.github.com/Neph0/21bcfcebc23596f76defad0e743ec929 
> > 
> > And here is gdb's output : 
> > https://gist.github.com/Neph0/0e668d427e2788c54f3d9b744c9a7abc 
> > 
> > Could anyone help me with that? There's no doubt my code has stupid 
> things 
> > in it. 
> > I've read a lot of documentation today but somehow I can't figure out 
> some 
> > things and I'm stuck trying things without fully understanding 
> > the big picture... 
> > 
> > Thanks in advance. 
> From your gist: 
>      Local<Context> context = isolate->GetCurrentContext(); 
> context->Enter(); // /!\ SIGSEGV HAPPENS HERE /!\ 
> I bet that context.IsEmpty() is true.  You could move this line up: 
>      Local<Function> lpe = Local<Function>::New(isolate, process_emit); 
> And then you can get its context with lpe->CreationContext(). 
> One last word of advice: conditionally creating a new isolate when 
> Isolate::GetCurrent() returns NULL is not going to work.  Objects and 
> functions are intrinsically tied to the isolate that created them. 

v8-users mailing list
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to