mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This routine takes a synchronous non-throwing main actor isolated closure without a result. If we are dynamically on the main actor, we just run the closure synchronously. Otherwise, we run a new task on the main actor and call the closure on that. This builds on top of the previous commit by using swift_task_isCurrentExecutorWithFlags in the implementation of this function. To backwards deploy this function on Darwin, I used some tricks from libdispatch to validate that we are on the main queue.
5 lines
109 B
C
5 lines
109 B
C
|
|
#include <dispatch/dispatch.h>
|
|
|
|
static inline void *getDispatchMain() { return (void *)&_dispatch_main_q; }
|