CiNN
CiNN

Reputation: 9870

NSAutoreleasePool thread and main thread sharing an autoreleased object

performSelectorOnMainThread with waitUntilDone:NO and withObject: an autoreleased object from the thread.
So just after the thread terminates itself with a [NSAutoreleasePool release]
What happens to my autorelease object from this thread that has been passed to the main thread ??

Upvotes: 2

Views: 699

Answers (1)

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81868

From the docs of performSelectorOnMainThread:withObject:waitUntilDone: "This method retains the receiver and the arg parameter until after the selector is performed."

Somebody (the runloop?) takes care of retaining the object for you until it's not needed any more.

Upvotes: 4

Related Questions