Files
swift-mirror/test/Concurrency/Runtime/Inputs/RunOnMainActor.h
Michael Gottesman b1750bad1a [concurrency] Implement swift_task_runOnMainActor.
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.
2024-10-17 11:17:38 -07:00

5 lines
109 B
C

#include <dispatch/dispatch.h>
static inline void *getDispatchMain() { return (void *)&_dispatch_main_q; }