Reputation: 163
I have a problem with the Objective c mutithreaded method.
[self performSelectorOnMainThread:@selector(displayThread2Counts:)
withObject:myNumber
waitUntilDone:NO];
What is the meaning of the parameter "waitUntilDone"?
What is the difference between waitUntilDone:YES
and waitUntilDone:NO
?
Upvotes: 2
Views: 540
Reputation: 54445
The documentation is pretty transparent:
A Boolean that specifies whether the current thread blocks until after the specified selector is performed on the receiver on the main thread. Specify YES to block this thread; otherwise, specify NO to have this method return immediately.
In other words, if you specify YES for the waitUntilDone parameter no other action will take place on the current thread until the requested selector has finished its work.
However as a corollary, if you're only using a single thread (the main thread) there's no value in specifying YES, as all you're effectively doing is calling the requested selector as you would in a non-threaded environment.
Upvotes: 3