Skip to content

Commit

Permalink
More locking to make thread sanitizer happy
Browse files Browse the repository at this point in the history
  • Loading branch information
jtung-apple committed May 6, 2024
1 parent 6356cbe commit baccc90
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/darwin/Framework/CHIPTests/MTRAsyncWorkQueueTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,17 @@ - (void)testItemsConcurrently

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

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

// see that all 3 first items ran and slept
os_unfair_lock_lock(&counterLock);
XCTAssertEqual(beforeSleepCounter, 3);
XCTAssertEqual(afterSleepCounter, 3);
os_unfair_lock_unlock(&counterLock);
}

@end

0 comments on commit baccc90

Please sign in to comment.