Instance Method

performAsynchronousFileAccessUsingBlock:

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

Declaration

- (void)performAsynchronousFileAccessUsingBlock:(void (^)(void (^fileAccessCompletionHandler)(void)))block;

Parameters

inBlock

A block that performs file access.

Discussion

This method does the same sort of work as performSynchronousFileAccessUsingBlock:, but without ever blocking the main thread, and may not invoke the block until after the method invocation has returned, though still always on the same thread as the method invocation. The block is passed another block, the file access completion handler, which must be invoked when the file access is complete, though it can be invoked from any thread. This method is for use with file access that might begin on one thread but continue on another before it is complete. For example, saveToURL:ofType:forSaveOperation:completionHandler: uses this method instead of performSynchronousFileAccessUsingBlock: because if it does asynchronous saving then there is no way for it to complete all of its file access before returning from the file access block.

See Also

Serialization

continueActivityUsingBlock:

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

continueAsynchronousWorkOnMainThreadUsingBlock:

Invokes the passed-in block on the main thread.

performActivityWithSynchronousWaiting:usingBlock:

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

performSynchronousFileAccessUsingBlock:

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