objective-c : @synchronized how it works ?

Posted by g.revolution on Stack Overflow See other posts from Stack Overflow or by g.revolution
Published on 2010-05-11T12:04:49Z Indexed on 2010/05/11 12:14 UTC
Read the original article Hit count: 364

Hi,

i have two methods

-(void) a {
   @synchronized(self) {
      // critical section 1 
   }
}

-(void) b {
   @synchronized(self) {
      // critical section 2 
   }
}

now my question is if a thread is in critical section 1. will the critical section 2 be locked for other threads or other threads can access critical section 2.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about multithreading