NSBlockOperation *blockOperation = ^{NSLog(@"This is an NSBlockOperation");};
NSOperationQueue *ownQueue = [[NSOperationQueue alloc] init];
[ownQueue setMaxConcurrentOperationCount:2];
[ownQueue addOperation:blockOperation];
我只是在尝试NSBlockOperation
,但是这个简单的代码以EXC_BAD_ACCESS
. 代码位于 main 中,并由@autorelease
.
libsystem_c.dylib`OSAtomicCompareAndSwapIntBarrier$VARIANT$mp:
0x7fff8b8dc524: movl %edi, %eax
libsystem_c.dylib`OSAtomicCompareAndSwap32$VARIANT$mp + 2:
0x7fff8b8dc526: lock
0x7fff8b8dc527: cmpxchgl%esi, (%rdx)
0x7fff8b8dc52a: sete %al
0x7fff8b8dc52d: movzbl %al, %eax
0x7fff8b8dc530: ret
0x7fff8b8dc531: nopl (%rax)
程序停止并指向0x7fff8b8dc526: lock