Re: RFC: libc6 policy supplement 2nd try
On Jun 14, Rob Browning wrote
> Helmut Geyer <Helmut.Geyer@IWR.Uni-Heidelberg.De> writes:
> > - compile the library using -D_RENTRANT or -D_THREAD_SAFE
> There was some talk about adding -D_REENTRANT to the list of flags
> that are automatically included by gcc/g++. I don't recall what the
> resulting decision was, if there was one.
This shouldn't be done, IMO. Compiling with -D_REENTRANT introduces
some overhead, albeit minimal, which shouldn't be forced upon
applications (i.e. non-libraries) which don't need it.
> > - there may be no permanent data residing in the library memory that
> > can be different for different threads.
> > this means in the first place no static or global variables that
> > are not in some way protected from access by a different threads.
> > - all write access to files from a library must be both protected
> > using some file locking mechanism in addition to using mutexes.
> > - library functions must be protected from being used at the same
> > time by two threads sharing the same memory space. This is done
> > using mutexes.
> In the general case, I'm not sure it's realistic to expect *all*
> libraries to be rewritten thread safe (though it would be nice). At
> the least, though, we should make certain that -D_REENTRANT is always
> used, and that it's at least safe to call a given library function if
> you make sure only one thread is in the library at a time. That
> should be easier to accomplish.
Yes. It should be possible for a threaded application to use any
library on the system, even if it must restrict access to that library
from a single thread.
David Engel ODS Networks
email@example.com 1001 E. Arapaho Road
(972) 234-6400 Richardson, TX 75081
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to firstname.lastname@example.org .