Pregunta

The Mono.Cairo Homepage says "Don't try to use Cairo in threads other than the main (Gdk) thread."

This would seem to imply that there is an issue using Cairo from multiple threads, such as in an ASP.NET application.

I would like to know if Cairo and Mono.Cairo can safely be used from multiple threads simultaneously as long as there is no shared data involved. (each thread has its own context/surface, etc).

If there is global locking, I would like to know about that as well. (System.Drawing.Graphics.DrawImage(), for example, is process-wide exclusive on many versions of Windows).

I found this bug which may or may not be relevant.

¿Fue útil?

Solución

ASP.NET and Gdk are completely unrelated. The former deals with HTTP, the latter deals with screens and native toolkits (X11, wayland, etc.).

The restriction that you saw in the Mono.Cairo homepage is the same as with any Gtk app: don't touch the UI in the incorrect thread. A handy tool to find out this wrong kind of manipulations at runtime in debug mode is gui-thread-check (which is now bundled by default inside Gtk-Sharp3).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top