[Wayland-bugs] [Bug 91273] It's not safe to share wl_display fd with other threads.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Jul 8 19:28:59 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=91273

            Bug ID: 91273
           Summary: It's not safe to share wl_display fd with other
                    threads.
           Product: Wayland
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: wayland
          Assignee: wayland-bugs at lists.freedesktop.org
          Reporter: boram1288 at gmail.com

Created attachment 117010
  --> https://bugs.freedesktop.org/attachment.cgi?id=117010&action=edit
simple test application to reproduce this bug

Condition:
2 threads polling on same display fd in both threads.

Result:
When one thread awakes, if it quickly reads all events from display fd before
kernel wakes up another, then another can't awake from poll(). I attached a
very simple test application to reproduce this.

Real example:
gstreamer's waylandsink can do polling on same diplay fd of toolkit's
main-thread(Such like GTK and EFL...).
(http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/wayland/wldisplay.c)
If waylandsink's thread reads all event using wl_display_read_events before
toolkit's main-thread awakes, although all events are queued into corresponding
event queues, default queue's events can't be handled because main-thread is
still sleeping.

Comment:
poll(), select()... seems not guarantee that kernel will wake all threads up
when events happen. Creating new queue seems a good solution if we want to
handle  events of a certain wl_proxy. But not in this case. Maybe using a
different display fd will be a good solution. But for using a different display
fd, we have to create new display, then waylandsink can't use parent surface
and create subsurface. Or else, can it be solution creating new fd for each
queue?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-bugs/attachments/20150709/0c2f1e82/attachment.html>


More information about the wayland-bugs mailing list