MCPcopy Create free account
hub / github.com/YACReader/yacreader / randomCalls

Method randomCalls

tests/concurrent_queue_test/concurrent_queue_test.cpp:666–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

664}
665
666void ConcurrentQueueTest::randomCalls()
667{
668 QFETCH(const int, queueThreadCount);
669 QFETCH(const int, userThreadCount);
670 QVERIFY(userThreadCount > 0);
671 QFETCH(const bool, boostEnqueueOperationWeight);
672
673 const auto printer = makeMessagePrinter(queueThreadCount);
674
675 ConcurrentQueue queue(queueThreadCount);
676 printer.printStartedMessage();
677
678 randomEngineProvider.resetEngines(userThreadCount);
679
680 std::vector<std::thread> userThreads;
681 userThreads.reserve(userThreadCount - 1);
682 for (int id = 1; id < userThreadCount; ++id) {
683 userThreads.emplace_back(RandomCaller(queue, total, id, queueThreadCount,
684 randomEngineProvider.engine(id),
685 boostEnqueueOperationWeight));
686 }
687 RandomCaller(queue, total, primaryThreadId, queueThreadCount,
688 randomEngineProvider.engine(primaryThreadId),
689 boostEnqueueOperationWeight)();
690
691 for (auto &t : userThreads)
692 t.join();
693
694 waitAndPrint(queue, printer);
695
696 QCOMPARE(total.load(), 0);
697}
698
699QTEST_APPLESS_MAIN(ConcurrentQueueTest)
700

Callers

nothing calls this directly

Calls 6

RandomCallerClass · 0.85
waitAndPrintFunction · 0.85
printStartedMessageMethod · 0.80
resetEnginesMethod · 0.80
joinMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected