<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GStreamer] Use RunLoop instead of GMainLoop in AudioFileReaderGStreamer"
   href="https://bugs.webkit.org/show_bug.cgi?id=151256#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GStreamer] Use RunLoop instead of GMainLoop in AudioFileReaderGStreamer"
   href="https://bugs.webkit.org/show_bug.cgi?id=151256">bug 151256</a>
              from <span class="vcard"><a class="email" href="mailto:cgarcia&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=151256#c3">comment #3</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=265476&amp;action=diff" name="attach_265476" title="Patch">attachment 265476</a> <a href="attachment.cgi?id=265476&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=265476&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=265476&amp;action=review</a>
&gt; 
&gt; &gt; Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:380
&gt; &gt; +    if (isMainThread()) {
&gt; &gt; +        RefPtr&lt;AudioBus&gt; returnValue;
&gt; &gt; +        auto threadID = createThread(&quot;AudioFileReader&quot;, [&amp;returnValue, filePath, mixToMono, sampleRate] {
&gt; &gt; +            returnValue = AudioFileReader(filePath).createBus(sampleRate, mixToMono);
&gt; &gt; +        });
&gt; &gt; +        waitForThreadCompletion(threadID);
&gt; &gt; +
&gt; &gt; +        return returnValue;
&gt; &gt; +    }
&gt; 
&gt; Would RunLoop::run() not set up a nested main loop in case of running this
&gt; in the main thread?</span >

Yes, but with the same main context, we need a different one to avoid deadlocks. Phil wrote the original code, so he should know the details.

<span class="quote">&gt; What about the cases where the bus is created in a non-main WebWorker thread
&gt; that's also managed via RunLoop, wouldn't that set up the nested loop?</span >

In that case a new RunLoop is created for the current thread. If those threads already a have a RunLoop running maybe we should always use a dedicated thread, though.</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>