| 23 | }; |
| 24 | |
| 25 | Y_UNIT_TEST(TestHugeSetup) { |
| 26 | TArrayHolder<X> x(new X[100000]); |
| 27 | |
| 28 | struct TThr: public ISimpleThread { |
| 29 | inline TThr(X* ptr) |
| 30 | : P(ptr) |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | void* ThreadProc() noexcept override { |
| 35 | for (size_t i = 0; i < 100000; ++i) { |
| 36 | P[i].Do(); |
| 37 | } |
| 38 | |
| 39 | return nullptr; |
| 40 | } |
| 41 | |
| 42 | X* P; |
| 43 | }; |
| 44 | |
| 45 | TThr thr1(x.Get()); |
| 46 | TThr thr2(x.Get()); |
| 47 | |
| 48 | thr1.Start(); |
| 49 | thr2.Start(); |
| 50 | |
| 51 | thr1.Join(); |
| 52 | thr2.Join(); |
| 53 | |
| 54 | for (size_t i = 0; i < 100000; ++i) { |
| 55 | UNIT_ASSERT_VALUES_EQUAL(x.Get()[i].Get(), 0); |
| 56 | } |
| 57 | } |
| 58 | } // Y_UNIT_TEST_SUITE(TTestTLS) |