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.
7 lines
125 B
C
7 lines
125 B
C
|
|
#include <stdint.h>
|
|
|
|
uintptr_t swift_task_getCurrent();
|
|
|
|
uintptr_t getCurrentTaskShim() { return swift_task_getCurrent(); }
|