-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable thread safety analysis for system mutex (#23678)
* Enable thread safety analysis for system mutex Thread Safety Analysis [1] is a clang extension tool which adds static analysis for potential race conditions. This commit adds support for such thread safety analysis to Matter system mutex class. Simple usage: int state CHIP_GUARDED_BY(stateMtx); chip::System::Mutex stateMtx; void setState(int value) { chip::System::MutexUniqueLock lock(stateMtx); state = value; } [1] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html * Reuse thread safety config from pigweed * No need to wrap std::lock_guard since clang c++ std library provides such functionality out of the box. The only requirements is that the _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 is defined. * Use thread safety with ConnectivityManagerImpl to prove that it works
- Loading branch information
Showing
3 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters