Skip to content

Commit

Permalink
Fix potential deadlock in waitUntilFinished. (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlutsenko authored Jul 12, 2016
1 parent eaba419 commit ce65a75
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Bolts/Common/BFTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ - (void)waitUntilFinished {
}
[self.condition lock];
}
while (!self.completed) {
// TODO: (nlutsenko) Restructure this to use Bolts-Swift thread access synchronization architecture
// In the meantime, it's absolutely safe to get `_completed` aka an ivar, as long as it's a `BOOL` aka less than word size.
while (!_completed) {
[self.condition wait];
}
[self.condition unlock];
Expand Down

0 comments on commit ce65a75

Please sign in to comment.