[cairo] Threading: painting from the same source_surface

Arjen Nienhuis a.g.nienhuis at gmail.com
Mon Nov 9 01:37:03 PST 2009

On Fri, Nov 6, 2009 at 6:12 PM, Arjen Nienhuis <a.g.nienhuis at gmail.com> wrote:
> On Fri, Nov 6, 2009 at 2:33 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>> Excerpts from Arjen Nienhuis's message of Fri Nov 06 13:18:52 +0000 2009:
>>> The result from thread 1 is T1_bad.jpg but should be T1_ok.jpg. (What
>>> happened to the text?)
>>> Thread 2 is fine and results in T2.jpg.
>> What is the connection of this bug to the shared source? What you have
>> described should work fine with cairo. What requires serialisation is
>> writing to the same objects (cairo_t and cairo_surface_t).
>> If you could provide a long snippet of code, or ideally a minimal test
>> case, we could help you further diagnose the issue.
>> -ickle
>> --
>> Chris Wilson, Intel Open Source Technology Centre
> I'm afraid that the bug is in that short snippet of code. The attached
> test case shows the same problem.
> As a minimal test case needs thraeding, I can only do this in python.
> If you need anything in C, can you please point me to a simple C
> program with threads?
> The example png here is one of 9 broken pngs in the result of 200.
> I run Ubuntu 8.10 with cairo 1.8.8.
> Met vriendelijke groet,
> Arjen Nienhuis

Does it help if I write a test for this like test/pthread-show-text.c
that can be included with cairo?

BTW: The problem doesn't show up with ubuntu 8.04 because it uses
pycairo version 1.4.12 (instead of 1.8.6 for Ubuntu 8.10) because that
version of pycairo is not multithreaded.

Met vriendelijke groet,
Arjen Nienhuis

More information about the cairo mailing list