MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / test_thread

Function test_thread

components/libc/cplusplus/utest/tc_thread.cpp:15–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include <thread>
14
15static void test_thread(void)
16{
17 int count = 0;
18 auto func = [&]() mutable
19 {
20 for (int i = 0; i < 100; ++i)
21 {
22 ++count;
23 }
24 };
25
26 std::thread t1(func);
27 t1.join();
28
29 if (count != 100)
30 {
31 uassert_false(1);
32 }
33
34 std::thread t2(func);
35 t2.join();
36
37 if (count != 200)
38 {
39 uassert_false(1);
40 }
41
42 uassert_true(1);
43}
44
45static rt_err_t utest_tc_init(void)
46{

Callers

nothing calls this directly

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected