Skip to content

Commit baccc90

Browse files
committed
More locking to make thread sanitizer happy
1 parent 6356cbe commit baccc90

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/darwin/Framework/CHIPTests/MTRAsyncWorkQueueTests.m

+4
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,17 @@ - (void)testItemsConcurrently
544544

545545
[self waitForExpectations:@[ first3WorkItemsExecutedExpectation ] timeout:2];
546546
// the before-sleep counter should have reached 3 immediately as they all run concurrently.
547+
os_unfair_lock_lock(&counterLock);
547548
XCTAssertEqual(afterSleepCounter, 0);
549+
os_unfair_lock_unlock(&counterLock);
548550

549551
[self waitForExpectations:@[ lastWorkItemWaitedExpectation, first3WorkItemsSleptExpectation ] timeout:2];
550552

551553
// see that all 3 first items ran and slept
554+
os_unfair_lock_lock(&counterLock);
552555
XCTAssertEqual(beforeSleepCounter, 3);
553556
XCTAssertEqual(afterSleepCounter, 3);
557+
os_unfair_lock_unlock(&counterLock);
554558
}
555559

556560
@end

0 commit comments

Comments
 (0)