On Tue, May 03, 2016 at 04:39:45PM +0700, Duy Nguyen wrote:

> On Tue, May 3, 2016 at 11:45 AM, Jeff King <[email protected]> wrote:
> > On Mon, May 02, 2016 at 11:26:02AM -0700, Junio C Hamano wrote:
> >
> >> Caller supplied buffer would be the way to go when multiple threads
> >> could be showing errors and warnings, right?
> >>
> >> It would not make too much of a difference for die(), though.
> >
> > I think it can matter for die(). This is happening above the pluggable
> > die_routine() layer, so it's possible for an async task to call die()
> > which will end in pthread_exit(), while the main program is calling
> > die() to end in regular exit().
> >
> > I imagine it's exceedingly unlikely, and of course both threads are
> > dying anyway, but it could result in some pretty weird memory errors.
> > It's probably worth taking precautions against, especially because it's
> > to easy to do so.
> 
> So, sum it up, the new fmt_with_err() will take a buffer and size.
> die_errno() sticks to its static buffer as before. error_errno() and
> warning_errno() can allocate 1k on stack to be more
> multithread-friendly. Let me know if some other change is needed.

Yes, though note that die_errno() currently has a stack buffer, not a
static one. It should remain that way (and error_errno and warning_errno
should follow suit) to be friendly to multi-threading.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to