ios while(![_ lock tryLock])崩溃

时间:2015-08-17 04:58:45

标签: ios crash locking

崩溃报告在这里:

>Exception Type:  SIGSEGV  
>Exception Codes: SEGV_ACCERR at 0x16b  

>Crashed Thread:  3  
>Thread 3 Crashed:  
>0   libobjc.A.dylib                     0x0000000195e7bbc8 objc_msgSend + 8  
>1   MSProject                           0x00000001001888a4 -[MStateDataAnalysis stopRecogniseTask] (MStateDataAnalysis.m:85)  
>.....  
>7   libdispatch.dylib                   0x00000001964e5954 _dispatch_client_callout + 16  
>8   libdispatch.dylib                   0x00000001964fc010 _dispatch_source_latch_and_call + 2052  
>9   libdispatch.dylib                   0x00000001964e7abc _dispatch_source_invoke + 288  
>10  libdispatch.dylib                   0x00000001964f2318 _dispatch_root_queue_drain + 720  
>11  libdispatch.dylib                   0x00000001964f3c4c _dispatch_worker_thread3 + 108  
>12  libsystem_pthread.dylib             0x00000001966c522c _pthread_wqthread + 816  
>13  libsystem_pthread.dylib             0x00000001966c4ef0 start_wqthread + 4

[MStateDataAnalysis stopRecogniseTask](MStateDataAnalysis.m:85)类第85行是:

 85  while (![_lock tryLock]) {  
     [NSThread sleepForTimeInterval:0.1];  
  }  
  _resultArray = nil;  
  _metroFlagArray = nil;  
  [_lock unlock];  

锁是:

@property(nonatomic, strong) NSLock                * lock;

因为_resultArray和_metroFlagArray在两个线程中使用,所以我使用了lock.But我不知道什么是错的,有小概率崩溃。

0 个答案:

没有答案