[MPlayer-dev-eng] configure: cleanups + bugfix for MT

pl p_l at gmx.fr
Fri Oct 12 02:01:50 CEST 2001


On Fri, Oct 12, 2001 at 01:32:07AM +0200, Arpi wrote:
[...]
> > > > AFAIK for Linux, too, the CFLAG -D_THREAD_SAFE should be added (same
> > > > thing as -D_REENTRANT  - check in /usr/include/feature.h).
> > > what does it exactly mean? as mplayer is single thread program, it
> > > should work, but it isn't really reentrant (uses lots of global vars)
> > 
> > Well... I don't have checked further but since there are
> > pthread_create() and mplayer is linked against -lpthread, this
> > -D_THREAD_SAFE should be used. (It was already there for *BSD so I did
> > not look further)
> > 
> > When you use this flag, it redefines errno on a per-thread basis (among
> > other things) and defines reentrant functions (blah_r).
> > If you don't, all your threads will write in one global errno value (for
> > instance).
> 
> hmm. then it's bad in viewpoint of speed.
> pthread isn't really used, but required by win32 dll loader (and maybe used
> by a few dll)
> 
> we shouldn't use reentrant versions as they are slower.
> and we don't need them as we never call them twice.

According to the LinuxThreads FAQ this flag is necessary.
[http://pauillac.inria.fr/~xleroy/linuxthreads/faq.html#H]

Quoting it: 
  "H.3: What happens if I link LinuxThreads with code
  not compiled with -D_REENTRANT?  Lots of trouble."

I don't think there's a big overhead in using a -D_THREAD_SAFE but it
should be checked.

There will be small overhead on several syscalls since they are wrapped
by the linuxthreads to provide cancellation points (IIRC).

Concerning, reentrant calls, they are only needed if you risk to clobber
some static values in the libc for instance, which doesn't seem to be
the case here. (I think of strtok() or inet_ntoa())

--
Regards,
  pl



More information about the MPlayer-dev-eng mailing list