I understand that
@synchronized(self) { /* lock is effective inside here only */ }
can keep multiple threads from accessing your method at the same time. So no one will be able to access what's inside the @synchronized{} while it is being used.
I there someway that I will allow only a limited number of threads, for example allow only 2 threads or 3 threads to access the method at the same time.
PS: I have a method which send synchronous Request, and I want to limit sending synchronous request at maximum of 3 at a time
@synchronized(self) {
webData = [NSURLConnection sendSynchronousRequest: request returningResponse: &response error: &error];
}