Using @synchronized directive on method body
-(void)testSynchronizeMethod:(int)value
{
@synchronized(value)
{
int value1 = 100; //sample line 1
int value2 = 120; //sample line 2
[self calledMethod];
}
}
//case 1
-(void)calledMethod
{
NSLog(@"is @synchronized directive applied to this method");
NSLog(@"what happens if I enclose this method with @synchronized directive");
}
**or**
//case 2
-(void)calledMethod
{
@synchronized(value){
NSLog(@"is @synchronized directive applied to this method");
NSLog(@"what happens if I enclose this method with @synchronized directive");
}
}
Q: In case 2 Are Two mutex locks created around '-(void)calledMethod'?
EDIT I'm getting a signal SIGINT on main thread while I'm using such mutex locks.
I'm attaching a screen grab if someone could suggest me what is going wrong?