On Thursday, September 1, 2016 at 12:54:20 AM UTC-7, Saúl Ibarra Corretgé wrote: > > On 09/01/2016 01:06 AM, J Decker wrote: > > I'm working on a simple network proxy addon for node (yes it's sort of a > > crossover issue, but the error happens in ... hmm no adding run fixed > > that... moved the problem I guess > > > > I cut out most of the excess code; there's still excess in the > > custructor callback... but I wanted to leave that flow intact. > > > > Was there a previous email I missed? I have no context thus far. > > No; that's about all the context I can give? I can provide a more complete example, and probably should. Unfortunatly I'm under windows at the moment, so I don't even know what the callback stack looks like; working on building it under linux today...
> > when creating a new object, I create a single uv_default_loop() that > > I'll never close ? > > > > That's going to be a problem. Node itself uses the default loop, so > you'd be using the same loop really, and uv_run is non-recursive, so you > cannot call it while it's already running, and it is, otherwise your JS > code wouldn't run. > > uv_run is only called during garbage collection, which should be the same thread that is the javascript? why would one want to use multiple loops? and add a loop per async then? > > on destructor I do uv_close( (uv_handle_t*)&async, NULL ); > > uv_run( fbdl.loop, UV_RUN_DEFAULT ); > > > > As mentioned above, bad idea. Even if you use a new loop, why? Why not > use the existing loop? Are you also using other threads? > > So I shouldn't use multple Async objects each with their own .data referencing a object? is the exsting loop ' get_default_loop()' so I shouldn't close it? I never do? > [snip] > > I haven't looked at the code, but you should just create the handle in > the loop which is attached to the current Environment, then just close > the handle when you're done with it. Note that it's not OK to free the > memory for the handle right after the call to uv_close, you need to pass > a callback and free it there. > > which is why I did it in the destructor; immediately after returning the memory is freed. > > Cheers, > > -- > Saúl Ibarra Corretgé > bettercallsaghul.com > > > -- You received this message because you are subscribed to the Google Groups "libuv" 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]. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
