Subject: Re: pthreads plan
To: Michael Graff <explorer@flame.org>
From: Charles M. Hannum <root@ihack.net>
List: tech-userlevel
Date: 11/06/1999 11:54:53
Michael Graff <explorer@flame.org> writes:

> root@ihack.net (Charles M. Hannum) writes:
> 
> > > What about something like this?
> > > 
> > > _getc():  no multithreaded support
> > > _getc_MT():  locking
> > > 
> > > and in the header file:
> > > #if defined(_REENTRANT)
> > > 	rename(getc, _getc_MT);
> > > #else
> > > 	rename(getc, _getc);
> > > #endif
> > 
> > That doesn't really help, since getc() is a macro.
> 
> Ok, I chose the wrong function to give an example against, but if you
> replace getc with, say, printf, would this idea work?

That depends on the goal.  You could probably get as much just by
using #define.

The problem is, this still allows cases of thread-safe and
non-thread-safe functions to be mixed, because the choice of which
function to use ends up compiled into each module that uses it.  I
don't think this is what Greg was asking for.

(OTOH, I'm not convinced it's actually a problem, either.)