我正在开发一个以时事通讯风格界面为中心的iPad应用程序。我使用苹果的UIPageViewController来做到这一点。
我遇到了很多我不完全理解的错误,我希望有人能帮助我找到解决方法。
在这个界面上翻页时,应用程序偶尔会冻结(这就是为什么它如此令人沮丧,因为它不容易复制)。我在调试器中暂停应用程序,这是它显示给我的http://cl.ly/image/1y3c2x351t0T.
我很清楚这是一个与核心数据相关的错误。以前在执行获取请求时发生过这种情况。我以为我解决了,但它一直在回来。
- (void)setupBlockViews{
//Setup the block views in the correct order
NSMutableArray *blockViewsInUse = [[[NSMutableArray alloc] init] autorelease];
for(NLNewsletterPageBlock *pageBlock in self.page.pageBlocks){
NLNewsletterPageBlockView *blockView = [self blockViewForBlock:pageBlock];
if(blockView){
blockView.parentPageVC = self;
[blockViewsInUse addObject:blockView];
}
}
//recycle block views if needed
if(RECYCLE_BLOCK_VIEWS){
NSMutableArray *oldBlockViews = [[[NSMutableArray alloc] init] autorelease];
for(NLNewsletterPageBlockView *blockView in self.blockViews){
if(![blockViewsInUse containsObject:blockView]){
[oldBlockViews addObject:blockView];
}
}
for(NLNewsletterPageBlockView *blockView in oldBlockViews){
[blockView prepareForReuse];
}
[self.recycledBlockViews addObjectsFromArray:oldBlockViews];
}
self.blockViews = blockViewsInUse;
[self layoutBlockViews];
}
在UIPageViewController委托方法pageViewController:(UIPageViewController*)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)方向中调用上述方法SetupBlockView。
在这个特定的实例中,错误发生在试图访问NSManagedObject的抓取属性时。即self.page.page块
我已经多次确保遵守线程、核心数据和托管对象上下文的所有规则,因此我认为它与线程和核心数据无关。
有人能理解这一点吗?这到底是怎么回事?
谢谢
以下是堆栈跟踪:
* thread #1: tid = 0x1c03, 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10, stop reason = signal SIGSTOP frame #0: 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x9a0f919b libsystem_c.dylib`pthread_mutex_lock + 595 frame #2: 0x013efb01 CoreData`-[_PFLock lock] + 33 frame #3: 0x013efada CoreData`-[NSPersistentStoreCoordinator lock] + 42 frame #4: 0x0140457e CoreData`-[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 1182 frame #5: 0x014029c9 CoreData`-[NSManagedObjectContext executeFetchRequest:error:] + 569 frame #6: 0x0145ddfa CoreData`-[NSFaultHandler retainedFulfillAggregateFaultForObject:andRelationship:withContext:] + 298 frame #7: 0x0148b5cf CoreData`-[_NSFaultingMutableArray willRead] + 143 frame #8: 0x0148baf3 CoreData`-[_NSFaultingMutableArray countByEnumeratingWithState:objects:count:] + 35 frame #9: 0x0000858c iNewsletter`-[NLNewsletterPageViewController setupBlockViews](self=0x1282ff30, _cmd=0x002e1491) + 206 at NLNewsletterPageViewController.m:408 frame #10: 0x00007724 iNewsletter`-[NLNewsletterPageViewController updateLowFootprint](self=0x1282ff30, _cmd=0x002e0ad7) + 62 at NLNewsletterPageViewController.m:253 frame #11: 0x0000495b iNewsletter`-[NLNewsletterViewController pageForIndex:](, _cmd=0x002e09cc) + 884 at NLNewsletterViewController.m:392 frame #12: 0x00009fc2 iNewsletter`-[NLNewsletterVC_AppleStyle goToPage:animated:](, _cmd=0x002e0afd) + 209 at NLNewsletterVC_AppleStyle.m:163 frame #13: 0x00006781 iNewsletter`-[NLNewsletterViewController thumbnailPVRecievedTouch:withEvent:](, _cmd=0x002e0949, sender=0x128bb9d0) + 667 at NLNewsletterViewController.m:779 frame #14: 0x02aac705 libobjc.A.dylib`-[NSObject performSelector:withObject:withObject:] + 77 frame #15: 0x019e3920 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 96 frame #16: 0x019e38b8 UIKit`-[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61 frame #17: 0x01aa4671 UIKit`-[UIControl sendAction:to:forEvent:] + 66 frame #18: 0x01aa4bcf UIKit`-[UIControl(Internal) _sendActionsForEvents:withEvent:] + 578 frame #19: 0x01aa3d38 UIKit`-[UIControl touchesEnded:withEvent:] + 546 frame #20: 0x01a1333f UIKit`-[UIWindow _sendTouchesForEvent:] + 846 frame #21: 0x01a13552 UIKit`-[UIWindow sendEvent:] + 273 frame #22: 0x019f13aa UIKit`-[UIApplication sendEvent:] + 436 frame #23: 0x019e2cf8 UIKit`_UIApplicationHandleEvent + 9874 frame #24: 0x03472df9 GraphicsServices`_PurpleEventCallback + 339 frame #25: 0x03472ad0 GraphicsServices`PurpleEventCallback + 46 frame #26: 0x00c80bf5 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53 frame #27: 0x00c80962 CoreFoundation`__CFRunLoopDoSource1 + 146 frame #28: 0x00cb1bb6 CoreFoundation`__CFRunLoopRun + 2118 frame #29: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #30: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #31: 0x034717e3 GraphicsServices`GSEventRunModal + 88 frame #32: 0x03471668 GraphicsServices`GSEventRun + 104 frame #33: 0x019e065c UIKit`UIApplicationMain + 1211 frame #34: 0x00002385 iNewsletter`main(argc=1, argv=0xbffff390) + 83 at main.m:16 thread #3: tid = 0x2203, 0x99d779ca libsystem_kernel.dylib`kevent64 + 10 frame #0: 0x99d779ca libsystem_kernel.dylib`kevent64 + 10 frame #1: 0x02d3fc2b libdispatch.dylib`_dispatch_mgr_invoke + 863 frame #2: 0x02d3f8cc libdispatch.dylib`_dispatch_mgr_thread + 61 thread #5: tid = 0x2403, 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #0: 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x99d73cb0 libsystem_kernel.dylib`mach_msg + 68 frame #2: 0x00caca49 CoreFoundation`__CFRunLoopServiceMachPort + 185 frame #3: 0x00cb18d4 CoreFoundation`__CFRunLoopRun + 1380 frame #4: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #5: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #6: 0x06c67310 WebCore`RunWebThread(void*) + 608 frame #7: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #6: tid = 0x2503, 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #0: 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x99d73cb0 libsystem_kernel.dylib`mach_msg + 68 frame #2: 0x00caca49 CoreFoundation`__CFRunLoopServiceMachPort + 185 frame #3: 0x00cb18d4 CoreFoundation`__CFRunLoopRun + 1380 frame #4: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #5: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #6: 0x0259bebe Foundation`+[NSURLConnection(Loader) _resourceLoadLoop:] + 393 frame #7: 0x024e40d5 Foundation`-[NSThread main] + 76 frame #8: 0x024e4034 Foundation`__NSThread__main__ + 1304 frame #9: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #9: tid = 0x2803, 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #0: 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x9a0f919b libsystem_c.dylib`pthread_mutex_lock + 595 frame #2: 0x013efb01 CoreData`-[_PFLock lock] + 33 frame #3: 0x013efada CoreData`-[NSPersistentStoreCoordinator lock] + 42 frame #4: 0x014040cc CoreData`-[NSManagedObjectContext(_NSInternalAdditions) lockObjectStore] + 76 frame #5: 0x0146164a CoreData`-[NSManagedObjectContext(_NSInternalAdditions) _dispose:] + 490 frame #6: 0x014611c5 CoreData`-[NSManagedObjectContext _dealloc__] + 325 frame #7: 0x01461077 CoreData`-[NSManagedObjectContext dealloc] + 103 frame #8: 0x0006927e iNewsletter`-[RHManagedObjectContext dealloc](self=0x0b04c880, _cmd=0x02d4dabe) + 176 at RHManagedObjectContextManager.m:53 frame #9: 0x014262f1 CoreData`-[NSManagedObjectContext release] + 81 frame #10: 0x00c8741c CoreFoundation`CFRelease + 108 frame #11: 0x00d8ed1e CoreFoundation`-[__NSDictionaryM dealloc] + 158 frame #12: 0x02aac9ff libobjc.A.dylib`-[NSObject release] + 47 frame #13: 0x0248ddcd Foundation`__NSFinalizeThreadData + 1295 frame #14: 0x00cbf5e2 CoreFoundation`__CFTSDFinalize + 98 frame #15: 0x9a0fa9c7 libsystem_c.dylib`_pthread_tsd_cleanup + 206 frame #16: 0x9a0f380f libsystem_c.dylib`_pthread_exit + 145 frame #17: 0x9a0f60b5 libsystem_c.dylib`_pthread_workq_return + 54 frame #18: 0x9a0f5e79 libsystem_c.dylib`_pthread_wqthread + 448 thread #13: tid = 0x2c03, 0x99d76be6 libsystem_kernel.dylib`select$DARWIN_EXTSN + 10 frame #0: 0x99d76be6 libsystem_kernel.dylib`select$DARWIN_EXTSN + 10 frame #1: 0x00ceecb7 CoreFoundation`__CFSocketManager + 1255 frame #2: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #15: tid = 0x2e03, 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #0: 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x9a0f8280 libsystem_c.dylib`_pthread_cond_wait + 833 frame #2: 0x9a17e0e0 libsystem_c.dylib`pthread_cond_timedwait$UNIX2003 + 70 frame #3: 0x07fcc82b JavaScriptCore`WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 123 frame #4: 0x07fa0bd9 JavaScriptCore`JSC::BlockAllocator::blockFreeingThreadMain() + 121 frame #5: 0x07fcbb8c JavaScriptCore`WTF::threadEntryPoint(void*) + 76 frame #6: 0x07fcc0e5 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 21 frame #7: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #16: tid = 0x2f03, 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #0: 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x9a0f8280 libsystem_c.dylib`_pthread_cond_wait + 833 frame #2: 0x9a17e095 libsystem_c.dylib`pthread_cond_wait$UNIX2003 + 71 frame #3: 0x07ed0ad7 JavaScriptCore`JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode) + 439 frame #4: 0x07ed085a JavaScriptCore`JSC::MarkStackThreadSharedData::markingThreadMain() + 234 frame #5: 0x07fcbb8c JavaScriptCore`WTF::threadEntryPoint(void*) + 76 frame #6: 0x07fcc0e5 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 21 frame #7: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #17: tid = 0x3003, 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #0: 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x9a0f60ac libsystem_c.dylib`_pthread_workq_return + 45 frame #2: 0x9a0f5e79 libsystem_c.dylib`_pthread_wqthread + 448 thread #19: tid = 0x3203, 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #0: 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x9a0f60ac libsystem_c.dylib`_pthread_workq_return + 45 frame #2: 0x9a0f5e79 libsystem_c.dylib`_pthread_wqthread + 448 thread #21: tid = 0x3403, 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #0: 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x9a0f60ac libsystem_c.dylib`_pthread_workq_return + 45 frame #2: 0x9a0f5e79 libsystem_c.dylib`_pthread_wqthread + 448 thread #22: tid = 0x3503, 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #0: 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x9a0f919b libsystem_c.dylib`pthread_mutex_lock + 595 frame #2: 0x013efb01 CoreData`-[_PFLock lock] + 33 frame #3: 0x013efada CoreData`-[NSPersistentStoreCoordinator lock] + 42 frame #4: 0x014040cc CoreData`-[NSManagedObjectContext(_NSInternalAdditions) lockObjectStore] + 76 frame #5: 0x014219c2 CoreData`_PFFaultHandlerLookupRow + 306 frame #6: 0x01421887 CoreData`-[NSFaultHandler fulfillFault:withContext:forIndex:] + 39 frame #7: 0x014214c1 CoreData`_PF_FulfillDeferredFault + 225 frame #8: 0x01421336 CoreData`_sharedIMPL_pvfk_core + 70 frame #9: 0x014521a0 CoreData`_pvfk_3 + 32 frame #10: 0x000063ab iNewsletter`-[NLNewsletterViewController thumbnailPickerView:imageAtIndex:](, _cmd=0x002e0f16, thumbnailPickerView=0x128bb9d0) + 239 at NLNewsletterViewController.m:723 frame #11: 0x000515c5 iNewsletter`__33-[ThumbnailPickerView reloadData]_block_invoke119(.block_descriptor=0x128c2fc0) + 81 at ThumbnailPickerView.m:230 frame #12: 0x02d3a53f libdispatch.dylib`_dispatch_call_block_and_release + 15 frame #13: 0x02d4c014 libdispatch.dylib`_dispatch_client_callout + 14 frame #14: 0x02d3c418 libdispatch.dylib`_dispatch_queue_drain + 239 frame #15: 0x02d3c2a6 libdispatch.dylib`_dispatch_queue_invoke + 59 frame #16: 0x02d3d280 libdispatch.dylib`_dispatch_root_queue_drain + 231 frame #17: 0x02d3d450 libdispatch.dylib`_dispatch_worker_thread2 + 39 frame #18: 0x9a0f5e72 libsystem_c.dylib`_pthread_wqthread + 441 thread #14: tid = 0x2d03, 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #0: 0x99d770ee libsystem_kernel.dylib`__workq_kernreturn + 10 frame #1: 0x9a0f60ac libsystem_c.dylib`_pthread_workq_return + 45 frame #2: 0x9a0f5e79 libsystem_c.dylib`_pthread_wqthread + 448 thread #24: tid = 0x3703, 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #0: 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x99d73cb0 libsystem_kernel.dylib`mach_msg + 68 frame #2: 0x00caca49 CoreFoundation`__CFRunLoopServiceMachPort + 185 frame #3: 0x00cb18d4 CoreFoundation`__CFRunLoopRun + 1380 frame #4: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #5: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #6: 0x068340b0 WebCore`WebCore::runLoaderThread(void*) + 208 frame #7: 0x07fcbb8c JavaScriptCore`WTF::threadEntryPoint(void*) + 76 frame #8: 0x07fcc0e5 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 21 frame #9: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344
以及下一次发生时的另一个堆栈跟踪:
thread #1: tid = 0x1c03, 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10, stop reason = signal SIGSTOP frame #0: 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x9a0f919b libsystem_c.dylib`pthread_mutex_lock + 595 frame #2: 0x013efb01 CoreData`-[_PFLock lock] + 33 frame #3: 0x013efada CoreData`-[NSPersistentStoreCoordinator lock] + 42 frame #4: 0x014040cc CoreData`-[NSManagedObjectContext(_NSInternalAdditions) lockObjectStore] + 76 frame #5: 0x014219c2 CoreData`_PFFaultHandlerLookupRow + 306 frame #6: 0x01421887 CoreData`-[NSFaultHandler fulfillFault:withContext:forIndex:] + 39 frame #7: 0x014214c1 CoreData`_PF_FulfillDeferredFault + 225 frame #8: 0x01421336 CoreData`_sharedIMPL_pvfk_core + 70 frame #9: 0x014521d0 CoreData`_pvfk_4 + 32 frame #10: 0x00016617 iNewsletter`-[NLNewsletter isReady](self=0x0b058010, _cmd=0x02679b09) + 53 at NLNewsletter.m:175 frame #11: 0x0002f7f8 iNewsletter`-[NLNewsletterContainerVC displayNewsletter](self=0x10bbe700, _cmd=0x002e4ea8) + 174 at NLNewsletterContainerVC.m:156 frame #12: 0x0002f743 iNewsletter`-[NLNewsletterContainerVC viewDidFinishPresenting](self=0x10bbe700, _cmd=0x002e1d74) + 79 at NLNewsletterContainerVC.m:145 frame #13: 0x02aac663 libobjc.A.dylib`-[NSObject performSelector:] + 62 frame #14: 0x0000b2f2 iNewsletter`__43-[NLStandarVC presentVC:fromView:animated:]_block_invoke(.block_descriptor=0x10b07830) + 289 at NLStandarVC.m:142 frame #15: 0x0000b499 iNewsletter`__43-[NLStandarVC presentVC:fromView:animated:]_block_invoke105(, finished='\x01') + 24 at NLStandarVC.m:159 frame #16: 0x01a2b446 UIKit`-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 223 frame #17: 0x01a1e3b6 UIKit`-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 237 frame #18: 0x01a1e554 UIKit`-[UIViewAnimationState animationDidStop:finished:] + 68 frame #19: 0x018f67d8 QuartzCore`CA::Layer::run_animation_callbacks(void*) + 284 frame #20: 0x02d4c014 libdispatch.dylib`_dispatch_client_callout + 14 frame #21: 0x02d3c7d5 libdispatch.dylib`_dispatch_main_queue_callback_4CF + 296 frame #22: 0x00cb1af5 CoreFoundation`__CFRunLoopRun + 1925 frame #23: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #24: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #25: 0x034717e3 GraphicsServices`GSEventRunModal + 88 frame #26: 0x03471668 GraphicsServices`GSEventRun + 104 frame #27: 0x019e065c UIKit`UIApplicationMain + 1211 frame #28: 0x00002385 iNewsletter`main(argc=1, argv=0xbffff390) + 83 at main.m:16 thread #3: tid = 0x2203, 0x99d779ca libsystem_kernel.dylib`kevent64 + 10 frame #0: 0x99d779ca libsystem_kernel.dylib`kevent64 + 10 frame #1: 0x02d3fc2b libdispatch.dylib`_dispatch_mgr_invoke + 863 frame #2: 0x02d3f8cc libdispatch.dylib`_dispatch_mgr_thread + 61 thread #5: tid = 0x2403, 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #0: 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x99d73cb0 libsystem_kernel.dylib`mach_msg + 68 frame #2: 0x00caca49 CoreFoundation`__CFRunLoopServiceMachPort + 185 frame #3: 0x00cb18d4 CoreFoundation`__CFRunLoopRun + 1380 frame #4: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #5: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #6: 0x06c67310 WebCore`RunWebThread(void*) + 608 frame #7: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #7: tid = 0x2603, 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #0: 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x99d73cb0 libsystem_kernel.dylib`mach_msg + 68 frame #2: 0x00caca49 CoreFoundation`__CFRunLoopServiceMachPort + 185 frame #3: 0x00cb18d4 CoreFoundation`__CFRunLoopRun + 1380 frame #4: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #5: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #6: 0x0259bebe Foundation`+[NSURLConnection(Loader) _resourceLoadLoop:] + 393 frame #7: 0x024e40d5 Foundation`-[NSThread main] + 76 frame #8: 0x024e4034 Foundation`__NSThread__main__ + 1304 frame #9: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #9: tid = 0x2803, 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #0: 0x99d7691a libsystem_kernel.dylib`__psynch_mutexwait + 10 frame #1: 0x9a0f919b libsystem_c.dylib`pthread_mutex_lock + 595 frame #2: 0x013efb01 CoreData`-[_PFLock lock] + 33 frame #3: 0x013efada CoreData`-[NSPersistentStoreCoordinator lock] + 42 frame #4: 0x014040cc CoreData`-[NSManagedObjectContext(_NSInternalAdditions) lockObjectStore] + 76 frame #5: 0x0146164a CoreData`-[NSManagedObjectContext(_NSInternalAdditions) _dispose:] + 490 frame #6: 0x014611c5 CoreData`-[NSManagedObjectContext _dealloc__] + 325 frame #7: 0x01461077 CoreData`-[NSManagedObjectContext dealloc] + 103 frame #8: 0x0006927e iNewsletter`-[RHManagedObjectContext dealloc](self=0x10b14960, _cmd=0x02d4dabe) + 176 at RHManagedObjectContextManager.m:53 frame #9: 0x014262f1 CoreData`-[NSManagedObjectContext release] + 81 frame #10: 0x00c8741c CoreFoundation`CFRelease + 108 frame #11: 0x00d8ed1e CoreFoundation`-[__NSDictionaryM dealloc] + 158 frame #12: 0x02aac9ff libobjc.A.dylib`-[NSObject release] + 47 frame #13: 0x0248ddcd Foundation`__NSFinalizeThreadData + 1295 frame #14: 0x00cbf5e2 CoreFoundation`__CFTSDFinalize + 98 frame #15: 0x9a0fa9c7 libsystem_c.dylib`_pthread_tsd_cleanup + 206 frame #16: 0x9a0f380f libsystem_c.dylib`_pthread_exit + 145 frame #17: 0x9a0f60b5 libsystem_c.dylib`_pthread_workq_return + 54 frame #18: 0x9a0f5e79 libsystem_c.dylib`_pthread_wqthread + 448 thread #13: tid = 0x2c03, 0x99d76be6 libsystem_kernel.dylib`select$DARWIN_EXTSN + 10 frame #0: 0x99d76be6 libsystem_kernel.dylib`select$DARWIN_EXTSN + 10 frame #1: 0x00ceecb7 CoreFoundation`__CFSocketManager + 1255 frame #2: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 * thread #15: tid = 0x2e03, 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #0: 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x9a0f8280 libsystem_c.dylib`_pthread_cond_wait + 833 frame #2: 0x9a17e0e0 libsystem_c.dylib`pthread_cond_timedwait$UNIX2003 + 70 frame #3: 0x07fcc82b JavaScriptCore`WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 123 frame #4: 0x07fa0bd9 JavaScriptCore`JSC::BlockAllocator::blockFreeingThreadMain() + 121 frame #5: 0x07fcbb8c JavaScriptCore`WTF::threadEntryPoint(void*) + 76 frame #6: 0x07fcc0e5 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 21 frame #7: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #16: tid = 0x2f03, 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #0: 0x99d768e2 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x9a0f8280 libsystem_c.dylib`_pthread_cond_wait + 833 frame #2: 0x9a17e095 libsystem_c.dylib`pthread_cond_wait$UNIX2003 + 71 frame #3: 0x07ed0ad7 JavaScriptCore`JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode) + 439 frame #4: 0x07ed085a JavaScriptCore`JSC::MarkStackThreadSharedData::markingThreadMain() + 234 frame #5: 0x07fcbb8c JavaScriptCore`WTF::threadEntryPoint(void*) + 76 frame #6: 0x07fcc0e5 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 21 frame #7: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344 thread #17: tid = 0x3003, 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #0: 0x99d747d2 libsystem_kernel.dylib`mach_msg_trap + 10 frame #1: 0x99d73cb0 libsystem_kernel.dylib`mach_msg + 68 frame #2: 0x00caca49 CoreFoundation`__CFRunLoopServiceMachPort + 185 frame #3: 0x00cb18d4 CoreFoundation`__CFRunLoopRun + 1380 frame #4: 0x00cb0f44 CoreFoundation`CFRunLoopRunSpecific + 276 frame #5: 0x00cb0e1b CoreFoundation`CFRunLoopRunInMode + 123 frame #6: 0x068340b0 WebCore`WebCore::runLoaderThread(void*) + 208 frame #7: 0x07fcbb8c JavaScriptCore`WTF::threadEntryPoint(void*) + 76 frame #8: 0x07fcc0e5 JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 21 frame #9: 0x9a0f35b7 libsystem_c.dylib`_pthread_start + 344
我发现一段代码运行在后台线程上,该线程正在访问在主线程上创建的NSManagedObject。我以前错过过。互斥错误现在消失了。
问题内容: 阅读有关锁定PHP的一些文章。 它们主要都直接指向http://php.net/manual/en/function.flock.php。 本页讨论如何在硬盘上打开文件! 真的是这样吗?我的意思是,这使锁定变得非常昂贵-这意味着每次要锁定时,我都必须访问硬盘)= 能再给我一个令人愉快的消息安慰我吗? 编辑: 由于我已经收到了一些答复,我想问这个。 我的脚本只能由一个或多个线程运行?因为
Go语言包中的 sync 包提供了两种锁类型:sync.Mutex 和 sync.RWMutex。 Mutex 是最简单的一种锁类型,同时也比较暴力,当一个 goroutine 获得了 Mutex 后,其他 goroutine 就只能乖乖等到这个 goroutine 释放该 Mutex。 RWMutex 相对友好些,是经典的单写多读模型。在读锁占用的情况下,会阻止写,但不阻止读,也就是多个 gor
互斥是多线程系统中用于控制访问的一个原对象(primitive object)。下面的例子给出了它最基本的用法: std::mutex m; int sh; //共享数据 // … m.lock(); // 对共享数据进行操作: sh += 1; m.unlock(); 在任何时刻,最多只能有一个线程执行到lock()和unlock()之间的区域(通常称为临界区)。当第一个线程正在临界区执行时
Introduction This is the fourth part of the chapter which describes synchronization primitives in the Linux kernel and in the previous parts we finished to consider different types spinlocks and semap
上面的例子中,我们看过了如何在多个协程之间原子地访问计数器,对于更复杂的例子,我们可以使用Mutex来在多个协程之间安全地访问数据。 package main import ( "fmt" "math/rand" "runtime" "sync" "sync/atomic" "time" ) func main() { // 这个例子的状态就
线程使用互斥量保护共享资源 线程使用互斥量保护共享资源 源码/* * Copyright (c) 2006-2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-08-24 yangjie the first versi