| 55 | }; |
| 56 | |
| 57 | BOOST_AUTO_TEST_CASE(ShouldNotifyOfBatchProcessorLifecycle) |
| 58 | { |
| 59 | ManualResetEvent startSignal(false); |
| 60 | ManualResetEvent shutdownSignal(false); |
| 61 | auto ringBuffer = std::make_shared< RingBuffer< StubEvent > >([] { return StubEvent(0); }, 16); |
| 62 | |
| 63 | auto sequenceBarrier = ringBuffer->newBarrier(); |
| 64 | auto eventHandler = std::make_shared< LifecycleAwareEventHandler >(startSignal, shutdownSignal); |
| 65 | auto batchEventProcessor = std::make_shared< BatchEventProcessor< StubEvent > >(ringBuffer, sequenceBarrier, eventHandler); |
| 66 | |
| 67 | auto thread = std::thread([&] { batchEventProcessor->run(); }); |
| 68 | |
| 69 | startSignal.waitOne(); |
| 70 | batchEventProcessor->halt(); |
| 71 | |
| 72 | shutdownSignal.waitOne(); |
| 73 | |
| 74 | thread.join(); |
| 75 | |
| 76 | BOOST_CHECK_EQUAL(eventHandler->startCounter(), 1); |
| 77 | BOOST_CHECK_EQUAL(eventHandler->shutdownCounter(), 1); |
| 78 | } |
| 79 | |
| 80 | BOOST_AUTO_TEST_SUITE_END() |
nothing calls this directly
no test coverage detected