Cairo exports and more (was Re: [cairo] Re: Munging header files
for export (and other) attributes)
Bill Spitzak
spitzak at d2.com
Mon Sep 19 11:07:24 PDT 2005
Alexander Larsson wrote:
> This method is called double checked locking, and it doesn't in general
> work for all hardware architectures. See e.g.
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
>
> glib uses this on architectures where it works. Looking at its
> configure.in it seems it doesn't work on old sparcs, alpha, ppc and
> ia64.
If it works on all platforms that are physically capable of compiling
and using Cairo then this is ok. Or you can ifdef it out and force the
lock on all tests if it does not work. Of since this only has to be in
the backend_surface_create function it is probably ok if it slows things
down by locking every time it is called (it is likely it has to lock
something anyway...).
I hope this does not detract from my initial reason for posting this,
which is:
Please do not put "initialization" into the Cairo API! There is an
obvious reason. If you do, all that is going to happen is that people
like me will erroneously try to call it with the wrong locking, and
screw up. The fact that my code is technically wrong should be PROOF
that you should not provide a mechanism to screw up like this.
More information about the cairo
mailing list