diff --git a/Bolts/Common/BFTask.m b/Bolts/Common/BFTask.m index 264e06055..1588d9e60 100644 --- a/Bolts/Common/BFTask.m +++ b/Bolts/Common/BFTask.m @@ -133,10 +133,10 @@ + (instancetype)taskForCompletionOfAllTasks:(nullable NSArray *)tasks [errors addObject:task.error]; } } else if (task.cancelled) { - OSAtomicIncrement32(&cancelled); + OSAtomicIncrement32Barrier(&cancelled); } - if (OSAtomicDecrement32(&total) == 0) { + if (OSAtomicDecrement32Barrier(&total) == 0) { if (exceptions.count > 0) { if (exceptions.count == 1) { tcs.exception = [exceptions firstObject];