Submits a single function to the dispatch queue and causes the function to be executed the specified number of times.
- iOS 4.0+
- macOS 10.6+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The number of iterations to perform.
The queue on which to submit the function. It is recommended that you specify
DISPATCHfor this parameter, as that causes the block to run on a queue whose quality-of-service class is most appropriate for the current execution context.
The application-defined context parameter to pass to the function.
The application-defined function to invoke on the target queue. This parameter cannot be NULL. The block has no return value and takes the following parameters:
The pointer you specified in the
The current iteration index.
This function submits an application-defined function to a dispatch queue for multiple invocations and waits for all iterations of the function to complete before returning. If the target queue is a concurrent queue returned by
dispatch, the function can be invoked concurrently, and it must therefore be reentrant-safe. Using this function with a concurrent queue can be useful as an efficient parallel
The current index of iteration is passed to each invocation of the function.