Subject: Re: Pthreads, libc, and the future
To: Curt Sampson <firstname.lastname@example.org>
From: Michael Graff <email@example.com>
Date: 12/13/1999 14:30:43
Curt Sampson <firstname.lastname@example.org> writes:
> > Not to mention that this would induce unnecessary overhead in threadless
> > programs. Think m68k and VAX.
> And much faster machines, too. A 500 MHz Pentium III can't do more
> than about 4-5 MB/sec to disk using getc() and putc() under Linux
> due to this sort of thing.
If you don't define _REENTRANT in our current code, you still get
normal, unlocked getc() and putc(). If you do, you get a function
rather than a macro. That function will always call a locking
function, which may be a do-nothing one or a real, live one.
Under FreeBSD (and I planned on doing it for us, too) a global int
__is_threaded is non-zero if threading is in use. I see no reason we
can't opt not to do these function calls if it is not set. That means
that in the non-threaded (but thread "capable") the overhead to find
out a lock isn't needed is
if (__is_threaded != 0)