Alright then. So, v8::initialize() first, and making the isolate afterwards. I now just have to look up how to properly make an isolate, but i will try this tomorrow - thanks for the hlp, by the way! ^.^ Am 20.03.2014 um 18:01 schrieb Ben Noordhuis <[email protected]>:
> On Thu, Mar 20, 2014 at 2:08 PM, Kevin Ingwersen > <[email protected]> wrote: >> Hey. >> Good to see someone who knows lots more than I do! >> >> I was really only going to have ONE exact node process. The other is a CEF >> browser process. the nodejs process is just to run a script in the >> background. I am writing an api to bridge the background to the foreground. >> its very trivial, just passing std::string back and forth using a project on >> github called channel (its a single-header project). >> Here is the example code that I currently use to test nodejs on threading: >> >> >> struct _Args_t { int arg_c; char** arg_v; } Args; >> void* runner(void* data) { >> cout << "Args: " << Args.arg_v[0] << endl; >> >> node::Start(Args.arg_c, Args.arg_v); >> return NULL; >> } >> int main(int argc, char *argv[]) { >> // Init the struct. >> Args.arg_c=argc; >> Args.arg_v=(char**)argv; >> cout << "..." << endl; >> >> pthread_t thatOtherThread; >> pthread_create(&thatOtherThread, NULL, runner, NULL); >> pthread_detach(thatOtherThread); >> sleep(5); >> return 0; >> } >> >> >> As you see, I am currently, as this is just testing, only spawning a thread, >> tryign to pick up a function that launches nodejs. I want to optimize the >> code later, but that should do for now, ot find out what I need to change in >> general. >> >> Since v8 seems to complain about the way its launched, what can I change in >> node.cc->node::Start() to make it work nicely? > > I bet it's because node::Start() calls node::Init() which in turn > calls v8::Isolate::GetCurrent() and assigns that to the node_isolate > global (which is scheduled to be removed but that aside.) > > v8::Isolate::GetCurrent() looks up the isolate in thread-local > storage; inside a new thread, that thread-local slot is NULL. > > You probably need to initialize V8 first, then create a new isolate > and enter it before calling node::Start(). -- -- v8-users mailing list [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
