Hi Fedor,

I'm referencing the cleanup from threadpool.c. It's decorated as an 
__attribute__((destructor)) and on master 
(https://github.com/joyent/libuv/blob/master/src/unix/threadpool.c) it's 
line 132.

It's definitely not written to support forking at the moment, so if this is 
a conscious design choice no problem, but I was curious after encountering 
the behavior.

Thanks,
MY

On Thursday, February 13, 2014 6:27:03 AM UTC-7, Fedor Indutny wrote:
>
> Heya! 
>
> Sorry, but I don't think that forking after initializing uv loop is 
> supported. What `cleanup` function are you talking about? 
>
> On Tue, Feb 11, 2014 at 8:49 PM, booch 
> <[email protected]<javascript:>> 
> wrote: 
> > 
> > 
> > On Monday, February 10, 2014 1:51:20 PM UTC-7, booch wrote: 
> >> 
> >> Hi all, 
> >> 
> >> I'm wondering if anyone knows an easy way around an issue I'm seeing. 
> >> 
> >> I have some code using libuv for its threadpool.c feature. 
> Unfortunately 
> >> this code forks. When the child exits we run the destructor code 
> >> theadpool.c:cleanup...since the child inherited most of the parent it 
> has an 
> >> allocated threads array, and initialized == 1, but since it's a fork it 
> has 
> >> no other started threads. With no other threads the uv_thread_join 
> fails and 
> >> the library aborts when unloading. 
> >> 
> >> Has anyone ran into this before and found a workaround? Is there a 
> >> notify_of_fork method that I'm missing? 
> >> 
> >> Thanks, 
> >> MY 
> > 
> > 
> > Update: I worked around this in the code I was refactoring, but am 
> > interested in people's thoughts on this still. Is the shutdown behavior 
> of 
> > threadpool expected; as in, works as designed and libuv thread pooling 
> is 
> > incompatible with forked processes. Or is this a bug and a 
> reset_after_fork 
> > or some other utility necessary? 
> > 
> > Thanks, 
> > MY 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected]<javascript:>. 
>
> > Visit this group at http://groups.google.com/group/libuv. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
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 http://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to