Subject: Re: libpthread busted?
To: Peter Seebach <>
From: Nathan J. Williams <>
List: current-users
Date: 02/28/2003 21:30:24
Bill Studenmund <> writes:

> From looking around w/ ldd, it seems like smpeg and SDL-image are both
> naughty. They seem to be the ones pulling libpthread.
> Not sure why though.

SDL-image is playing defensive; it's using mutexes to protect its
internal state from being mangled by multithreaded caller
applications. However, it doesn't need the full pthread library to do
that, since it doesn't actually need locks if the calling application
isn't threaded. This is the same dance we do with the internal mutexes
in libc.

The right thing here is for libc to export its thread-operation
stubs as pthread functions, and then to make SDL-image and similar
libraries not link directly against libpthread, but let the libc stubs
satisfy their mutex-locking needs until and unles the library is
linked into a threaded application. This prevents pulling into unwary applications, which as you've seen, has all
sorts of failure modes.

Or, to put it another way, you should wait until we fix this :) I'll
have a go at it over the weekend and should be able to have something
done by Monday.

        - Nathan