Is cairo thread-safe

"快乐2013" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi, I want to use cairo in multi-threads context, anybody know if cairo is thread-safe? especially the cairo_t object.
I found some mutex related code, so i guess cairo lib might be threadsafe.
Who can tell me the truth?

void threadDrawFunc(void *cr)
{
  // do we need lock cr here?
  // lock();

  // sample drawing code
  cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size (cr, 32.0);
  cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
  cairo_move_to (cr, 10.0, 50.0);

  cairo_show_text (cr, text);

  // unlock();
}

void mainThread()
{
         cairo_surface_t *surface =             cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80);          cairo_t *cr =             cairo_create (surface);

         create_thread(threadDrawFunc, cr);

         // wait threads to exit
         join_thread(...);

         cairo_destroy (cr);

         cairo_surface_write_to_png (surface, "c:/temp/hello-cairo.png");
         cairo_surface_destroy (surface);
}

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.