Hello!

Every interaction with v8 should happen in main thread. Ref() sounds like
something that you may want to do.

On Wed, Oct 15, 2014 at 4:04 AM, Grant Hutchins <[email protected]>
wrote:

> I have a Node ObjectWrap subclass object that handles a uv_async_send from
> a thread I don't control (from a key-value store library I'm using that can
> trigger an event at any time). I would like to make sure that if
> uv_async_send is triggered from this other thread, I can call Ref() on my
> ObjectWrap so that its v8 object doesn't get GC'ed before the async fires
> on the main loop.
>
> So far the only way I've gotten things to work is to call Ref() in the
> constructor of the ObjectWrap, but that means that it never gets GC'ed. I'd
> prefer that it get GC'ed as normal, except when an event has come in and
> triggered a uv_async_send that hasn't yet been processed on the v8 main
> loop.
>
> It seems that I keep running into a race condition between somehow getting
> the main loop to call Ref() and hoping the GC doesn't fire before that and
> delete the v8 object and thus my ObjectWrap. Am I correct in assuming that
> Ref() must be called from the main loop?
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/35beb9be-7a51-41a9-9c44-7d6ca5d80933%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/35beb9be-7a51-41a9-9c44-7d6ca5d80933%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAEv2Vf%2BKKJfbsqfhkGTkvXxsZLKLsFkwmyp8Y0niu_ty4bcOgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to