We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5130

Summary: Synchronous dispatch causes deadlock
Product: SDL Reporter: Emir Marincic <learath2>
Component: videoAssignee: Alex Szpakowski <amaranth72>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: HG 2.1Keywords: target-2.0.16
Hardware: x86_64   
OS: macOS 10.15   
Attachments: Patch

Description Emir Marincic 2020-05-10 16:04:05 UTC
Created attachment 4336 [details]
Patch

http://hg.libsdl.org/SDL/rev/19c4516de68d

This revision changes the `performSelectorOnMain` with a `dispatch_sync` which ignores the `waitUntilDone:NO`.

This causes a deadlock if the main thread is waiting on the auxilliary thread that caused this dispatch.

I've been running a copy with a `dispatch_async` instead and it seems stable, one thing I'm not sure about is the `setView` dispatch. Preliminary investigation would suggest that'd also be fine as an async dispatch but as I don't really know which bug that fixes I haven't tested it, thus I haven't included it in this patch.
Comment 1 Sam Lantinga 2020-05-13 00:49:29 UTC
Alex, can you review this?

Thanks!
Comment 2 Emir Marincic 2020-10-18 16:56:19 UTC
Ping? This is a bug that's rather annoying to workaround as you need to compile with an older version of the SDK and that brings problems with it. If you don't think this is the correct way to fix this maybe we can discuss and figure out a better way?

https://github.com/teeworlds/teeworlds/issues/2624
https://github.com/ddnet/ddnet/issues/2173