[cairo] Scaled font locking issues

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 17 03:17:35 PDT 2007

I've integrated a pthread correctness validator into the memfault
valgrind skin (in the interests of ensuring that mutex handling is
correct even on the error paths). To begin with, lockdep adds a macro
that checks whether a mutex is actually held which allows us to document
and check (in the form of asserts) locking preconditions for functions.
By adding the asserts to cairo-scaled-font.c we can quickly catch all
the callers who have forgotten to acquire the scaled-font mutex. As such
both the ps and pdf surfaces are suspect as well as a call from

I've resolved the issues found by moving the locking to the backends
which is noted to be more error-prone. As I've only enforced the locking
rules for the manipulation of the scaled_font itself I may have removed
instances where the lock was required for correct serialisation of calls
to the various backends. For example, both the Quartz and Win32 backends
are now run entirely without holding the scaled_font mutex. Can people
who know the various backends review the patches to check the minimalist
approach is sound and not just introducing even more problems?
Chris Wilson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lockdep.patch
Type: text/x-diff
Size: 4595 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20070917/ca5c179c/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scaled-font.patch
Type: text/x-diff
Size: 18120 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20070917/ca5c179c/attachment-0001.patch 

More information about the cairo mailing list