Concerning the Renderer “draw” routine in Chap 15 of Metal Tutorials, beginning with a semaphore.wait. I’m looking more at the sample code than the book. (The only mentions of semaphore in the book are on pages 438 and page 441).
If any error occurs, the “draw” routine exits without a requisite semaphore.signal (as occurs in the completion routine). I believe this effectively hangs the app for good – ie. in the case that any temporary error occurs.
Should not all the early “return” situations from the draw function also signal the semaphore?
This same code creates a weak reference to the semaphore just before the completion handler runs (“weak var set = semaphore”). Based on what I see in WWDC2016 Video #603 “Adopting Metal, Part 2” (@31:30) this is not the suggested way to reference a semaphore within a completion handler.
Which is the accepted way of doing things?
Great work, folks!