A mutex blocks only the main thread when it reaches its call with the @synchronized directive
问题 I'm building a multithreaded application, from which more than one thread can write to an sqlite3 database including the main thread. I declared a static public variable to be used for the mutex: @implementation Application #pragma mark - #pragma mark Static Initializer static NSString * SubmitChangesLock = nil; + (void)initialize { [super initialize]; SubmitChangesLock = [[NSString alloc] initWithString:@"Submit-Changes-Lock"]; } + (NSString *)submitChangesLock { return SubmitChangesLock; }