<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - It's not safe to share wl_display fd with other threads."
   href="https://bugs.freedesktop.org/show_bug.cgi?id=91273">91273</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>It's not safe to share wl_display fd with other threads.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Wayland
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>wayland
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>wayland-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>boram1288@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=117010" name="attach_117010" title="simple test application to reproduce this bug">attachment 117010</a> <a href="attachment.cgi?id=117010&action=edit" title="simple test application to reproduce this bug">[details]</a></span>
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...).
(<a href="http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/wayland/wldisplay.c">http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/wayland/wldisplay.c</a>)
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?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>