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.
self
in this instance refers to the class, instead of an instance. In ObjC, classes are themselves objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With