Thread safety when rendering on a separate thread

Guillermo Rodriguez at
Mon Jan 27 10:43:50 UTC 2020

Hi all,

I have a Wayland client where the main loop runs on a thread and
rendering is done in a separate thread. The main loop simply uses

while (wl_display_dispatch(globals.display) != -1) {
    [...process user input...]

This is the only place where events are processed.

Rendering however is done on a separate thread, which eventually ends
up calling:

wl_surface_attach(surface, buffer, 0, 0);
wl_surface_damage(surface, x, y, width, height);

Is this safe or do I need to do any additional locking / synchronization?

Thank you,

Guillermo Rodriguez Garcia

More information about the wayland-devel mailing list