[cairo] Condition variables
Chris Wilson
chris at chris-wilson.co.uk
Wed Sep 19 08:17:26 PDT 2007
I've extended the cairo-test framework to run tests across multiple
threads in an effort to stress cairo and uncover races. So far I've hit
two from cairo-xlib-surface. The first was a fairly trivial case where
the display list could be updated whilst
_cairo_xlib_call_close_display_hooks() was running. The second is a
little more difficult as it involves a surface being removed from the
solid-surface-cache and thus destroyed, whilst simultaneously it is
being detached from the display due to a XCloseDisplay. The only sane
way I can see of avoiding this race is by stalling the
_cairo_xlib_surface_finish() whilst the display is being closed (after
which the resources are marked as freed and so no work is queued from
the _finish()). So in order to stall the function I require a condition
variable. I've attached a patch for the pthread case, but I don't know
how trivial condvars are on other architectures (e.g. GLib's
implementation for win32 is definitely not trivial!).
--
Chris Wilson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cond.patch
Type: text/x-diff
Size: 2229 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20070919/3f52bb79/attachment.patch
More information about the cairo
mailing list