[cairo] Cairo and multithreading einvironment.

cu cairouser at yahoo.com
Thu Jul 21 17:48:26 PDT 2011


Cairo seems to be getting "less" thread-safe as time goes on. We are
using version 1.9.8 which we found to be most multithreading-friendly.
We still have to serialize all text operations and of course no two
threads can render to the same surface at the time. However, 1.9.8
permits simultaneous rendering into separate surfaces and even allows
the same source to be used for more than one surface at a time.

Unfortunately every version after 1.9.8 was non-thread safe for all of
the above operations - so we can't upgrade (probably ever, since there
does not seem to be much effort in this direction).

--cu

Horodyski Marek (PZUZ) wrote:
>
> > -----Original Message-----
>
> > From: Horodyski Marek (PZUZ)
>
> > Sent: Friday, July 15, 2011 12:28 PM
>
> > To: cairo at cairographics.org
>
> > Subject: Cairo and multithreading einvironment.
>
> […]
>
> > Cairo works well in an sigle thread environment, but I have problems in
>
> > multi-threaded.
>
> When I use Cairo In MultiThread environment without mutex synchronize,
> on monitor I see :
>
> cid:image002.png at 01CC1723.7C2D4EA0
>
> I can work with mutex synchronize, but but it costs time L
>
> Example code :
>
> hSurface := cairo_pdf_surface_create( "TEST.PDF", 566.9, 793.7 ) //
> 200x280 mm in pt
>
> hCairo := cairo_create( hSurface )
>
> cairo_set_source_rgb( hCairo, 0, 0, 0 )
>
> cairo_select_font_face( hCairo, "verdana", CAIRO_FONT_SLANT_NORMAL, 0 )
>
> cairo_set_font_size( hCairo, 6 )
>
> cairo_move_to( hCairo, 1, 7 )
>
> cairo_show_text( hCairo, "Some text")
>
> ...
>
> cairo_show_page( hCairo )
>
> cairo_destroy( hCairo )
>
> cairo_surface_destroy( hSurface )
>
> String "TEST.PDF" in different thread are differ.
>
> Regards,
>
> Marek Horodyski
>
> ------------------------------------------------------------------------
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list