I have this piece of code which is executed from different threads. I cant find wheres the deadlock. Maybe Im not undestanding how @syncronized works
@synchronized(self) {
NSLog(@"%@", self);
NSLog(@"(%d) Aloha hermano blocked?" ,pthread_mach_thread_np(pthread_self()) );
genres = [aContext executeFetchRequest:request error:&error];
if (error != nil) {
NSLog(@"Obj list fetch error: %@", error);
exit(-1);
}
NSLog(@"(%d) Aloha hermano NO" ,pthread_mach_thread_np(pthread_self()) );
}
Heres the traces when the app gets locked:
2012-11-27 13:28:05.141 (15143) Aloha hermano blocked?
2012-11-27 13:28:05.146 (15143) Aloha hermano NO
2012-11-27 13:28:05.152 <STBConnection_0_9: 0xc676000>
2012-11-27 13:28:05.155 (15143) Aloha hermano blocked?
2012-11-27 13:28:05.161 (15143) Aloha hermano NO
2012-11-27 13:28:05.168 <STBConnection_0_9: 0xc676000>
2012-11-27 13:28:05.171 (15143) Aloha hermano blocked?
2012-11-27 13:28:05.178 (15143) Aloha hermano NO
2012-11-27 13:28:05.185 <STBConnection_0_9: 0xc676000>
2012-11-27 13:28:05.191 (1799) Aloha hermano blocked?
As you can see Im syncronizing always on the same object.
Any ideas? Thanks a lot