File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 3434/* End PBXBuildFile section */
3535
3636/* Begin PBXContainerItemProxy section */
37- 413AD8C020AF73AB00AD7F36 /* PBXContainerItemProxy */ = {
37+ 412CDD2D20B88EAB00AF5890 /* PBXContainerItemProxy */ = {
3838 isa = PBXContainerItemProxy;
3939 containerPortal = OBJ_1 /* Project object */;
4040 proxyType = 1;
4141 remoteGlobalIDString = "Concurrency::Concurrency";
4242 remoteInfo = Concurrency;
4343 };
44- 413AD8C120AF73AB00AD7F36 /* PBXContainerItemProxy */ = {
44+ 412CDD2E20B88EAB00AF5890 /* PBXContainerItemProxy */ = {
4545 isa = PBXContainerItemProxy;
4646 containerPortal = OBJ_1 /* Project object */;
4747 proxyType = 1;
258258 OBJ_42 /* PBXTargetDependency */ = {
259259 isa = PBXTargetDependency;
260260 target = "Concurrency::ConcurrencyTests" /* ConcurrencyTests */;
261- targetProxy = 413AD8C120AF73AB00AD7F36 /* PBXContainerItemProxy */;
261+ targetProxy = 412CDD2E20B88EAB00AF5890 /* PBXContainerItemProxy */;
262262 };
263263 OBJ_54 /* PBXTargetDependency */ = {
264264 isa = PBXTargetDependency;
265265 target = "Concurrency::Concurrency" /* Concurrency */;
266- targetProxy = 413AD8C020AF73AB00AD7F36 /* PBXContainerItemProxy */;
266+ targetProxy = 412CDD2D20B88EAB00AF5890 /* PBXContainerItemProxy */;
267267 };
268268/* End PBXTargetDependency section */
269269
Original file line number Diff line number Diff line change @@ -81,12 +81,18 @@ public class CountDownLatch {
8181 }
8282
8383 condition. lock ( )
84+ defer {
85+ condition. unlock ( )
86+ }
8487 // Check count again after acquiring the lock, before entering waiting. This ensures the caller
8588 // does not enter waiting after the last counting down occurs.
86- if conditionCount. value > 0 {
87- return condition. wait ( until: deadline)
89+ // NSCondition must be run in a loop, since it can wake up randomly without any siganling.
90+ while conditionCount. value > 0 {
91+ let result = condition. wait ( until: deadline)
92+ if !result || Date ( ) > deadline {
93+ return false
94+ }
8895 }
89- condition. unlock ( )
9096 return true
9197 }
9298
You can’t perform that action at this time.
0 commit comments