| 13 | #include <thread> |
| 14 | |
| 15 | static 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 | |
| 45 | static rt_err_t utest_tc_init(void) |
| 46 | { |