<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    On 07/10/2023 13:59, Alan Snyder wrote:<br>
    <blockquote type="cite" cite="mid:0DCC2CCE-F246-42F0-8D07-3D2D50C33D7B@cbfiddle.com">
      
      I’ve been investigating a problem with a long running application
      that accumulates an apparently unbounded number of
      <div>CVDisplayLink threads. I do not yet have an explanation or a
        test case.</div>
      <div><br>
      </div>
      <div>The code that creates and releases CVDisplayLinks looks fine,
        but that assumes there are no threading issues.</div>
      <div>It looks like there are threading issues.</div>
      <div><br>
      </div>
      <div>Specifically, it appears that the startDisplayLink and
        stopDisplayLink methods of<span style="caret-color: rgb(0, 0,
          0); color: rgb(0, 0, 0);"> the Objective-C class MTLLayer are
          invoked on multiple threads.</span></div>
      <div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br>
        </span></div>
      <div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">They
          are invoked on the AppKit main thread from screen sleep
          notifications and blitTexture.</span></div>
      <div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br>
        </span></div>
      <div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">They
          are invoked on the EDT from </span><font color="#000000"><span style="caret-color: rgb(0, 0, 0);">MTLLayer.validate.</span></font></div>
      <div><font color="#000000"><span style="caret-color: rgb(0, 0,
            0);"><br>
          </span></font></div>
      <div><font color="#000000"><span style="caret-color: rgb(0, 0,
            0);">They are invoked on the Queue Flusher thread
            from MTLRenderQueue.flushBuffer.</span></font></div>
      <div><font color="#000000"><span style="caret-color: rgb(0, 0,
            0);"><br>
          </span></font></div>
      <div>Perhaps someone familiar with this code could comment?</div>
      <div><br>
      </div>
    </blockquote>
    It would be better to being this to client-lib-dev as that is where
    the metal pipeline is maintained.<br>
    <br>
    -Alan<br>
  </body>
</html>