[PATCH] D21506: [analyzer] Block in critical section
Zoltán Dániel Török via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 19 10:54:53 PDT 2016
zdtorok created this revision.
zdtorok added reviewers: zaks.anna, dcoughlin, xazax.hun.
zdtorok added a subscriber: cfe-commits.
zdtorok set the repository for this revision to rL LLVM.
This checker should find the calls to blocking functions (for example: sleep, getc, fgets,read,recv etc.) inside a critical section. When sleep(x) is called while a mutex is held, other threads cannot lock the same mutex. This might take some time, leading to bad performance or even deadlock.
Example:
```
mutex_t m;
void f() {
sleep(1000); // Error: sleep() while m is locked! [f() is called from foobar() while m is locked]
// do some work
}
void foobar() {
lock(m);
f();
unlock(m);
}
```
Repository:
rL LLVM
http://reviews.llvm.org/D21506
Files:
include/clang/StaticAnalyzer/Checkers/Checkers.td
lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
lib/StaticAnalyzer/Checkers/CMakeLists.txt
test/Analysis/block-in-critical-section.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21506.61206.patch
Type: text/x-patch
Size: 6229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160619/54db3e3c/attachment-0001.bin>
More information about the cfe-commits
mailing list