在Obj-C中,简单来说意味着什么; "CoreData不是线程安全的"
或者一般来说什么是"非线程安全"?
我正在做2个Core Data提取,当它们大约在同一时间执行时,它们将导致主线程中的死锁,导致我的应用程序冻结.
提取是在主线程上进行的.处理它的一种方法是确保提取不是在同一时间进行的,但我无法控制何时进行提取.有没有其他办法可以避免这种僵局?
暂停应用程序时的堆栈跟踪是:
#0 0x9a5d191a in __psynch_mutexwait ()
#1 0x9166713b in pthread_mutex_lock ()
#2 0x01e5d591 in -[_PFLock lock] ()
#3 0x01e5d56a in -[NSPersistentStoreCoordinator lock] ()
#4 0x01e720ee in -[NSPersistentStoreCoordinator executeRequest:withContext:error:] ()
#5 0x01e70539 in -[NSManagedObjectContext executeFetchRequest:error:] ()
#6 0x0007cd62 in -[CoreDataHelper fetchEntity:predicate:andSortDescriptors:inManagedObjectContext:] at /xxx/CoreDataHelper.m:150
#7 0x000075f6 in -[RemindersListViewController refreshReminders] at /xxx/RemindersListViewController.m:64
#8 0x000082f8 in -[RemindersListViewController refreshGUI] at /xxx/RemindersListViewController.m:187
#9 0x00003735 in __58-[AppDelegate setTabCountAndScheduleRemindersInBackground]_block_invoke_2 at /xxx/AppDelegate.m:114
#10 0x022dc53f in _dispatch_call_block_and_release ()
#11 0x022ee014 in _dispatch_client_callout ()
#12 0x022de7d5 in _dispatch_main_queue_callback_4CF …Run Code Online (Sandbox Code Playgroud)