Enqueues a block object on a given runloop to be executed as the runloop cycles in specified modes.
- iOS 4.0+
- macOS 10.6+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
A run loop.
A CFString that identifies a runloop mode, or a CFArray of CFStrings that each identify a runloop mode.
The block object to execute.
The block is copied by the function before the function returns.
When the runloop runs in the specified
mode, the block object is executed. You can use this function as a means to offload work to another thread similar to Cocoa’s
perform(_: and related methods. You can also use it as an alternative to mechanisms such as putting a CFRunLoopTimer in the other thread's run loop, or using CFMessagePort to pass information between threads.
This method enqueues the block only and does not automatically wake up the specified run loop. Therefore, execution of the block occurs the next time the run loop wakes up to handle another input source. If you want the work performed right away, you must explicitly wake up that thread using the