Wayland Message Behaviour

Turner, LewisX lewisx.turner at intel.com
Fri Nov 17 13:22:39 UTC 2017


Hi pq,

Thank you for your response regarding multiple threads.

It seems to be the case that we have an additional thread within the server, and so we will look at removing this and use just a single thread.

We will continue our efforts towards this approach.

Regards,
Lewis

-----Original Message-----
From: Pekka Paalanen [mailto:ppaalanen at gmail.com] 
Sent: Thursday, November 16, 2017 8:37 AM
To: Turner, LewisX <lewisx.turner at intel.com>
Cc: Derek Foreman <derekf at osg.samsung.com>; wayland-devel at lists.freedesktop.org
Subject: Re: Wayland Message Behaviour

On Wed, 15 Nov 2017 15:47:32 +0000
"Turner, LewisX" <lewisx.turner at intel.com> wrote:

> Hi Derek and pq,
> 
> Thanks for the further suggestions and comments.
> 
> The idea around multiple threads is a likely candidate. We have added 
> a thread and the flush is coming from the extra thread.
> 
> There seems to be two obvious approaches to solving the issue:
> 1) Create a new queue for our new thread and just flush the new queue.
> 2) Signal back to the main thread to request that the queue is 
> flushed.
> 
> Do you have any advice/opinion on which approach might be better? Are 
> there any examples of taking either approach?

Hi,

this is about server-side, yes?

There are no such queues server-side, so option 1 is impossible.

Option 2 sounds like you would still be sending Wayland events from multiple threads. That is not reliable.

I cannot see any way to share Wayland library objects between threads unless you explicitly add full locking around all libwayland-server calls. I would guess that will be painful, and it is also impossible, because your component is not the only one doing those calls, you would have to patch everything used on the server side.

Multiple threads have never been supported in libwayland-server. There is literally no locking whatsoever to prevent threads from corrupting objects by simultaneous access. I cannot stress this enough. The only solution I can see, if you must have multiple threads, is to architect your program so that all libwayland-server objects (wl_display, wl_client, wl_resource, wl_event_loop, etc.) are only ever accessed from a single thread.


Thanks,
pq
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928



More information about the wayland-devel mailing list