struct Baton {
uv_work_t request;
Persistent<Function> callback;
};
baton->callback.Dispose();Baton *baton = new Baton(); baton->request.data = baton; baton->callback = Persistent<Function>::New(Handle<Function>::Cast(args[0]));
uv_queue_work(uv_default_loop(), &baton->request, Work, AfterWork);
..
}void AfterWork(uv_work_t *req) {
Baton *baton = static_cast<Baton *>(req->data); HandleScope scope;
const int argc = 1;
Handle<Value> argv[argc] = { String::NewFromUtf8(isolate, "hello world") };
TryCatch try_catch;
baton->callback->Call(Context::GetCurrent()->Global(), argc, argv);
if (try_catch.HasCaught()) { node::FatalException(try_catch); }
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/03c2fc5d-86c5-4b00-b732-8841de2ea574%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/03c2fc5d-86c5-4b00-b732-8841de2ea574%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.