[MPlayer-dev-eng] [PATCH] use pthreads for caching

A Mennucc mennucc1 at debian.org
Sat Jan 27 09:57:53 CET 2007


hi Rich

Rich Felker ha scritto:
> I agree. The beauty of MPlayer's cache code is that it works (or it's
> supposed to work; off_t larger than system wordsize puts a nasty kink
> in it..) without heavy thread-synchronization mechanisms, just simple
> processes with shared memory. I suspect linking to and initializing
> theads when they're not needed could active nasty locking mechanisms
> in the C library (malloc, etc.) possibly causing performance loss. In
> any case I insist on any thread use being optional because I cannot
> use a version that requires threads, and the requirement of threads
> precludes porting to certain systems.

wait wait wait.

There is no "requirement of threads" ; if ./configure does not set
HAVE_PTHREADS then the forking code will be used

So you can still compile mplayer in any architecture that is not
offering pthreads, as you did before.

(I cheched this fact by manually unsetting HAVE_PTHREADS in config.h
and recompiling).

note that you cannot port the 'forking code' to some architectures as
well: it uses code in osdep/shmem.c that needs HAVE_SHM

so with my patch you can use caching code in mplayer in system
that either HAVE_PTHREADS or HAVE_SHM ;
w/o my patch, you can only do that if HAVE_SHM

If some people do not like using pthreads at all, I can rewrite the
patch to have yet another conditional CACHE_USE_PTHREADS so that my code
can be disabled even when pthreads are available.


a.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20070127/f77e9072/attachment.pgp>


More information about the MPlayer-dev-eng mailing list