[cairo] Review of: [cairo-mutex] Warn if no mutex definition found and let sanity macros err about undefined CAIRO_MUTEX macros.

Carl Worth cworth at cworth.org
Mon Apr 23 12:55:14 PDT 2007

>     [cairo-mutex] Warn if no mutex definition found and let sanity macros err
>     about undefined CAIRO_MUTEX macros.
> diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h
> index 5150b8e..ad0a941 100644
> --- a/src/cairo-mutex-private.h
> +++ b/src/cairo-mutex-private.h
> @@ -134,10 +134,12 @@ typedef int cairo_mutex_t;
>  #else /**********************************************************************/
> -# define CAIRO_MUTEX_LOCK(name)
> -# define CAIRO_MUTEX_UNLOCK(name)
> +# warning "XXX: No mutex implementation found.  Define CAIRO_NO_MUTEX to 1" \
> +          "     to compile cairo without thread-safety support."
> +
> +#endif

I don't like this.

What we had in 1.4.2 and earlier was the following:

	# error "No mutex declarations. Cairo will not work with multiple threads." \
        "(Remove this #error directive to acknowledge & accept this limitation)."

and I was pretty happy with that. If you _really_ needed a cairo build
without mutexes for some reason, and you were willing to limit the use
of cairo to only single-threaded applications, then you could
physically modify the cairo source code and remove an error that
explicitly said "Cairo will not work with multiple threads".

I like how explicit the acknowledgement was in that case.

Now, apparently we broke that in 1.4.4, (I don't know exactly how
things ended up if you tried to compile that without mutexes). But at
least that error directive was gone.

I think adding a CAIRO_NO_MUTEX define is too weak. If we are going to
make this work with a define rather than modifying the source, then
I'd at least like to give it a much scarier name:


or something like that. Or we can just put the #error back in.

But this is a sort of "build API" change, so we probably should have
talked about it on the list before committing it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070423/a118b4fa/attachment.pgp

More information about the cairo mailing list