Instance Method

continueAsynchronousWorkOnMainThreadUsingBlock:

Invokes the passed-in block on the main thread.

Declaration

- (void)continueAsynchronousWorkOnMainThreadUsingBlock:(void (^)(void))block;

Parameters

block

The block to be invoked.

Discussion

If the main thread is blocked by an invocation of performActivityWithSynchronousWaiting:usingBlock: or performSynchronousFileAccessUsingBlock:, this method interrupts that blocking to invoke the block, and then resumes blocking when the invocation of the block has returned. Invocations of this method always return before the passed-in block is invoked.

You can invoke this method when work is being done on a non-main thread and part of the work must be continued on the main thread. For example, saveToURL:ofType:forSaveOperation:completionHandler: uses this method when it has just completed the actual writing of the file during asynchronous saving and, to finish the saving operation, must invoke updateChangeCountWithToken:forSaveOperation: and other methods on the main thread.

This method can be invoked on any thread.

See Also

Serialization

- continueActivityUsingBlock:

Invokes the passed-in block to avoid a deadlock if performActivityWithSynchronousWaiting:usingBlock: is being invoked recursively.

- performActivityWithSynchronousWaiting:usingBlock:

Waits for any work scheduled by previous invocations of this method to complete, then invokes the passed-in block.

- performAsynchronousFileAccessUsingBlock:

Waits for any scheduled file access to complete but without blocking the main thread, then invokes the passed-in block.

- performSynchronousFileAccessUsingBlock:

Waits for any scheduled file access to complete, then invokes the passed-in block.