Subject: Re: fork(2) vs. pthread_create() (fwd)
To: Bill Studenmund <wrstuden@NetBSD.org>
From: Nathan J. Williams <firstname.lastname@example.org>
Date: 06/11/2004 15:16:59
Bill Studenmund <wrstuden@NetBSD.org> writes:
> On Fri, Jun 11, 2004 at 12:51:47PM -0400, Nathan J. Williams wrote:
>> Bill Studenmund <email@example.com> writes:
>> >> We are able to output error messages...
>> > From a library? No. You can't.
>> Emmanuel is pointing out that we do, in fact, print messages to stderr
>> in the various mutex error-detecting conditions that normally
>> abort. They can be configured to just print the message and not abort,
>> or to do neither.
>> Perhaps we "shouldn't", but it's wrong to say that we "can't".
> Yes, it was "can't" as in "that's really bad," not as in "can not be
> physically done."
Please don't use the former form of "can't". That's what "shouldn't"
> I was under the (perhapse mistaken) understanding that we sprinkled
> assert(3) calls in our libraries, but didn't actually compile them into
> assert calls in our normal libraries. You can build a debug version and
> have all the assertions turned on.
That's incorrect. assert(3) is live by default, but can be *disabled*
by compiling with -DNDEBUG, which we don't do anywhere in the tree
except one spot inside the libc regex engine.
> Also, assert(3) is a little different than what I believed had been
> suggested, in that it aborts if it is triggered. Thus it is obvious
> _something_ happened, even if no message is visible.
Yes, but if you are worried about stderr pointing somewhere dangerous,
then assert(3) should worry you, because it will write to stderr
before calling abort(3).