- (void)decrementActivityCount {
[self willChangeValueForKey:@"activityCount"];
bool success;
do {
int32_t currentCount = (int32_t)_activityCount;
success = OSAtomicCompareAndSwap32(currentCount, MIN(currentCount - 1, currentCount), &_activityCount);
//Incompatible pointer types passing 'NSInteger *' (aka 'long *') to parameter of type 'volatile int32_t *' (aka 'volatile int *')
} while(!success);
[self didChangeValueForKey:@"activityCount"];
[self updateNetworkActivityIndicatorVisibilityDelayed];
}
_activityCount is an NSInteger
Above is my code and two issues.
- What is the OSAtmonicCompareAndSwap32 actually doing?
- How can I remove the warning?