Hey everyone, I'm having so much fun making my first AddOn for Node. I ran into one stumbling block, and a lot of things I see in researching the web aren't complete enough for me to understand, or outdated information.
Anyway - I spawn a thread that performs a bunch of work. During the processing of that work, I'd like to call out an event to Node.js. I can almost do that, but I get a segmentation fault. Now, I know I've been warned that calling a Node function from a separate thread would result in a seg fault - but I thought I'd try something lame and call a a function, and THAT function would be scoped to node, thinking it might be OK. When that didn't work, I actually stopped the thread from running, and had my callback on the thread complete callback. Still a seg fault when put there! So what's the strategy here? If it helps, here's my code: void onFrameWorkerThreadComplete (uv_work_t *req) { HandleScope scope; Baton *m = (Baton *)req->data; m->callback.Dispose(); delete m; delete req; const unsigned argc = 1; Local<Value> argv[argc] = { Local<Value>::New(String::New("hello world")) }; JSCallback->Call(Context::GetCurrent()->Global(), argc, argv); } The callback does work in a different context - like I could put the callback in another method and it would fire, calling the Javascript method and outputting the string. Its just that when I put it anywhere near these threads, it seg faults. I'm sure I'm just doing things completely wrong, and there's a trick I'm not aware of. thanks! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en