I'm writing a asynchronous Node Addon, but I have been struggling to figure
out if I need to use a HandleScope in the "After" function that calls the
client JavaScript callback. I've seen examples showing with and without new
scopes, but never any explanation why. Here is an example:
void asyncWorkAfter(uv_work_t* req) {
HandleScope scope; // <-- Do you need a new scope?
const int argc = 1;
Local<Value> foo = String::New("foo");
Local<Value> argv[] = { foo };
// assume I got my callback function out of req
callback->Call(Context::GetCurrent()->Global(), argc, argv);
callback.Dispose();
// if i use a new HandleScope, what happens to argv when we go out of scope?
// Do i need to do something like a scope.Close() to copy argv to the parent
scope?}
Do you need/want a HandleScope when you call the callback?
What happens to argv in the example if you do use a new HandleScope?
Thanks for the help!
Cecil
--
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.