Skip to content

Commit 6356cbe

Browse files
committed
Address review comments
1 parent 446f1e0 commit 6356cbe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/darwin/Framework/CHIPTests/MTRAsyncWorkQueueTests.m

+4-3
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,12 @@ - (void)testItemsConcurrently
508508
}
509509
os_unfair_lock_unlock(&counterLock);
510510
sleep(1);
511+
os_unfair_lock_lock(&counterLock);
511512
afterSleepCounter++;
512513
if (afterSleepCounter == 3) {
513514
[first3WorkItemsSleptExpectation fulfill];
514515
}
516+
os_unfair_lock_unlock(&counterLock);
515517
completion(MTRAsyncWorkComplete);
516518
};
517519

@@ -533,9 +535,8 @@ - (void)testItemsConcurrently
533535
workItemLast.readyHandler = ^(id context, NSInteger retryCount, MTRAsyncWorkCompletionBlock completion) {
534536
// expect this to have waited until at least one of the above items finished after sleep() and incremented counter
535537
os_unfair_lock_lock(&counterLock);
536-
if (afterSleepCounter > 0) {
537-
[lastWorkItemWaitedExpectation fulfill];
538-
}
538+
XCTAssert(afterSleepCounter > 0);
539+
[lastWorkItemWaitedExpectation fulfill];
539540
os_unfair_lock_unlock(&counterLock);
540541
completion(MTRAsyncWorkComplete);
541542
};

0 commit comments

Comments
 (0)