Skip to content

Commit 6164b13

Browse files
committed
test case update
1 parent 27fa710 commit 6164b13

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
| test.cpp:16:14:16:15 | call to mutex | Mutex used by thread potentially destroyed while in use. |
2+
| test.cpp:134:14:134:15 | call to mutex | Mutex used by thread potentially destroyed while in use. |

cpp/common/test/rules/donotallowamutextogooutofscopewhilelocked/test.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,20 @@ void f10() {
122122
threads[i] = std::thread(t5, i);
123123
}
124124
}
125+
126+
void join_threads(std::thread *threads) {
127+
for (int i = 0; i < 5; ++i) {
128+
threads[i].join();
129+
}
130+
}
131+
132+
void f11() {
133+
std::thread threads[5];
134+
std::mutex m1; // NON_COMPLIANT (FALSE POSITIVE)
135+
136+
for (int i = 0; i < 5; ++i) {
137+
threads[i] = std::thread(t1, i, &m1);
138+
}
139+
140+
join_threads(threads);
141+
}

0 commit comments

Comments
 (0)