Hi Folks,

I've been using cairo to do some threaded rendering using an image surface.
After the rendering completes, it is pushed to an Xlib surface via the Gtk+
main loop. However, being that pixman_image_ref() and pixman_image_unref()
use ++ and -- to increment and decrement ref counts, occasionally I get a
double free in libc. Obviously, this only occurs under the scenario of many
concurrent renderings.

If I where to go through and work on making the reference counting thread safe,
what things would I need to make sure I take into account for the patch to be
accepted? For example:

  * Do we just need to use __sync_fetch_and_add()/__sync_sub_and_fetch()
    within the functions?
  * Should we abstract the atomic operations to support compilers other
    than GCC? If so, what compilers do we need to support?
  * Do we wan't to fallback to ++/-- when used under X since threading
    isn't needed? (Add something like pixman_thread_init()).
  * Is it okay to start with just pixman_image_t and support others
    in future patches?

Looking forward to your comments and suggestions.

-- Christian
_______________________________________________
Pixman mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to