[cairo] Recent commit of pthread support in configure.ac src/cairo-image-surface.c src/cairoint.h src/cairo-png.c src/cairo-surface.c

Carl Worth cworth at cworth.org
Fri Feb 19 10:24:33 PST 2010

On Mon, 25 Jan 2010 13:17:30 -0800 (PST), company at kemper.freedesktop.org (Benjamin Otte) wrote:
> commit bac513a85dc8ef2915b2e60d034cf3dbc82a8e0c
> Author: Benjamin Otte <otte at redhat.com>
> Date:   Mon Jan 25 20:05:56 2010 +0100
>     build: Fix pthread detection
>     THe pthread.h detection code didn't pass -lpthread or -pthread to Cairo.
> -  pthread_REQUIRES="pthread-stubs"
> +  pthread_REQUIRES="pthread"
>    PKG_CHECK_MODULES(pthread, $pthread_REQUIRES,
>  		    [use_pthread=yes; have_pthread=yes],
> -		    [AC_CHECK_HEADERS([pthread.h], [use_pthread=yes; have_pthread=yes], [use_pthread="no (requires $pthread_REQUIRES)"])])
> +		    [AC_CHECK_HEADERS([pthread.h], [use_pthread=yes;
> +                                                    pthread_CFLAGS="-pthread"
> +                                                    pthread_LIBS="-pthread"
> +                                                    have_pthread=yes
> +                                                   ], [use_pthread="no (requires $pthread_REQUIRES)"])])

I don't think the above is correct.

The concept with (Linux glibc at least) is that there are no-op stubs
(as weak aliases) for the pthread functions in the C library. That way,
a single-threaded application (without linking against libpthread) will
have less overhead for things like taking mutexes.

Then an application that actually *does* link against libpthread gets
the real symbols.

The pthreads-stubs package is then an implementation of the same weak
aliases, but outside of the C library, (for use on systems where the C
library doesn't provide this functionality itself).

So, linking cairo unconditionally against libpthread will defeat this
entire optimization. (And I think the patch above was mistaken anyway
since it passes -pthread instead of -lpthread in pthread_LIBS).

Shall we just revert this?

What was the actual problem you were having that motivated this patch?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20100219/35ab2b51/attachment-0001.pgp 

More information about the cairo mailing list