| 46 | } |
| 47 | |
| 48 | bool run () |
| 49 | { |
| 50 | alloc = make_unique(new FastAllocator(nullptr,false)); |
| 51 | numFailed.store(0); |
| 52 | |
| 53 | size_t numThreads = getNumberOfLogicalThreads(); |
| 54 | barrier.init(numThreads+1); |
| 55 | |
| 56 | /* create threads */ |
| 57 | std::vector<thread_t> threads; |
| 58 | for (size_t i=0; i<numThreads; i++) |
| 59 | threads.push_back(createThread((thread_func)thread_alloc,this)); |
| 60 | |
| 61 | /* run test */ |
| 62 | for (size_t i=0; i<1000; i++) |
| 63 | { |
| 64 | alloc->reset(); |
| 65 | barrier.wait(); |
| 66 | barrier.wait(); |
| 67 | } |
| 68 | |
| 69 | /* destroy threads */ |
| 70 | for (size_t i=0; i<numThreads; i++) |
| 71 | join(threads[i]); |
| 72 | |
| 73 | alloc = nullptr; |
| 74 | |
| 75 | return numFailed == 0; |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | fast_allocator_regression_test fast_allocator_regression; |
no test coverage detected