What is the best way to write a thread safe method?
I have the following method, sometimes i want to call it asynchronously (call it through a thread) And sometimes i want to call it directly on the main thread. Is there a problem with keeping the pool (alloc, release) even if I am not calling the method on a separate thread?
- (void)doStuff
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
//do some stuff here?
[pool release];
}