Commit 7bbdffca authored by Subodh Iyengar's avatar Subodh Iyengar Committed by Alecs King

Add test for running after terminate

Summary:
Add a test to check what will happen if
someone tries to run a job on evb after
termination.

Test Plan: Unit tests

Reviewed By: seanc@fb.com

Subscribers: seanc, folly-diffs@, yfeldblum

FB internal diff: D1882308

Signature: t1:1882308:1425333248:7ab6692eb0b866fcc9685048eb385bacd90023d1
parent bc847809
......@@ -1309,6 +1309,20 @@ TEST(EventBaseTest, RunInLoopStopLoop) {
ASSERT_LE(c1.getCount(), 11);
}
TEST(EventBaseTest, TryRunningAfterTerminate) {
EventBase eventBase;
CountedLoopCallback c1(&eventBase, 1,
std::bind(&EventBase::terminateLoopSoon, &eventBase));
eventBase.runInLoop(&c1);
eventBase.loopForever();
bool ran = false;
eventBase.runInEventBaseThread([&]() {
ran = true;
});
ASSERT_FALSE(ran);
}
// Test cancelling runInLoop() callbacks
TEST(EventBaseTest, CancelRunInLoop) {
EventBase eventBase;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment