Hi there,
I have a block of code that is accessed frequently and from either the main thread or several other background threads. I need to ensure that this code only gets processed one at a time.
I'm currently using a @synchronized(self) { }
block but I'm not sure if that's providing the correct protection. How does it differ from an NSLock
instance?
Finally, can anyone suggest how I can protect my method? The method is in my application delegate, and I access it from various threads by calling:
[[[UIApplication sharedApplication] delegate] myMethod];
Many thanks,
Mike