| 5107 | } |
| 5108 | |
| 5109 | bool large_traits() |
| 5110 | { |
| 5111 | union Elem { uint32_t x; char dummy[156]; }; |
| 5112 | |
| 5113 | ConcurrentQueue<Elem, LargeTraits> q(10000, 0, 48); |
| 5114 | std::vector<SimpleThread> threads(48); |
| 5115 | for (size_t tid = 0; tid != threads.size(); ++tid) { |
| 5116 | threads[tid] = SimpleThread([&](size_t tid) { |
| 5117 | const size_t ELEMENTS = 5000; |
| 5118 | if (tid != 0) { |
| 5119 | // Produce |
| 5120 | for (uint32_t i = 0; i != ELEMENTS; ++i) |
| 5121 | q.try_enqueue(Elem { ((uint32_t)tid << 16) | i }); |
| 5122 | } |
| 5123 | else { |
| 5124 | // Consume |
| 5125 | Elem item[256]; |
| 5126 | for (size_t i = 0; i != ELEMENTS * 200; ++i) |
| 5127 | q.try_dequeue_bulk(item, sizeof(item) / sizeof(item[0])); |
| 5128 | } |
| 5129 | }, tid); |
| 5130 | } |
| 5131 | for (size_t tid = 0; tid != threads.size(); ++tid) { |
| 5132 | threads[tid].join(); |
| 5133 | } |
| 5134 | |
| 5135 | return true; |
| 5136 | } |
| 5137 | }; |
| 5138 | |
| 5139 | } |
nothing calls this directly
no test coverage detected