TEST(AsioTransportLayer, UseTimerAfterReactorShutdown) {
TestFixture tf;
Notification<void> shutdown;
auto reactor = tf.tla().getReactor(TransportLayer::kNewReactor);
auto timer = reactor->makeTimer();
auto reactorThread = stdx::thread([reactor, &shutdown] {
LOGV2(8703700, "running reactor");
reactor->run();
LOGV2(8703701, "reactor stopped, draining");
reactor->drain();
LOGV2(8703702, "reactor drain complete");
shutdown.set();
});
auto timer1 = timer->waitUntil(Date_t::now() + Seconds(5));
std::move(timer1).get();
LOGV2(8703704, "first timer fired");
LOGV2(8703704, "shutting down reactor");
reactor->stop();
shutdown.get();
LOGV2(8703704, "setting second timer");
auto timer2 = timer->waitUntil(Date_t::now() + Seconds(5));
std::move(timer2).get(); LOGV2(8703704, "second timer fired");
reactorThread.join();
}