Accidentally I have been using a @synchronized block with the semaphore self in a class method.
+(void)someFunction {
@synchronized(self) {
/* some code */
}
}
It seems to be valid code, at least the compiler does not give me any bad feedback. My question is: what is self here? As far as I can tell the @synchronized block didn’t work, but it didn’t crash either.
I’m just asking out of curiousity.
selfin this instance refers to the class, instead of an instance. In ObjC, classes are themselves objects.