[cairo] Condition variables

Behdad Esfahbod behdad at behdad.org
Thu Sep 20 10:59:30 PDT 2007

On Wed, 2007-09-19 at 11:17 -0400, Chris Wilson wrote:
> 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!). 

Hi Chris,

I'm not sure I understand.  What's wrong with locking a shared
per-display mutex in both _cairo_xlib_surface_finish() and XCloseDisplay


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

More information about the cairo mailing list