On Donnerstag, 14. April 2011, Jeff King wrote:
So what do you want to do about the fd that needs closing? The options
I see are:
1. Try for a general solution. That probably means the "close every
descriptor in the child" hackiness that I mentioned earlier.
2. Fix this case by having the async code close it if it was forked.
It needs to know whether we forked, so we can:
a. Use NO_PTHREADS. Easy and simple, though it does break
start_async's abstraction a bit.
b. Have start_async pass in a flag telling what happened. This
really breaks the abstraction very similarly to (a), but it
makes the connection more explicit.
I think I am leaning a bit towards (2a). It's simple, and it's not like
this is library code with a million unknown callers; fixing it simply
and cleanly with a nice commit message is probably sufficient.
(2a) would be good enough for my taste, too!
-- Hannes