[core] Fix RunLoop::run() behavior when called a second time
This commit is contained in:
@@ -151,6 +151,7 @@ void RunLoop::push(std::shared_ptr<WorkTask> task) {
|
||||
void RunLoop::run() {
|
||||
MBGL_VERIFY_THREAD(tid);
|
||||
|
||||
uv_ref(impl->holderHandle());
|
||||
uv_run(impl->loop, UV_RUN_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,3 +29,24 @@ TEST(RunLoop, MultipleStop) {
|
||||
|
||||
loop.run();
|
||||
}
|
||||
|
||||
TEST(RunLoop, MultipleRun) {
|
||||
RunLoop loop(RunLoop::Type::New);
|
||||
|
||||
Timer timer;
|
||||
timer.start(mbgl::Duration::zero(), mbgl::Duration::zero(), [&] {
|
||||
loop.stop();
|
||||
});
|
||||
|
||||
loop.run();
|
||||
|
||||
bool secondTimeout = false;
|
||||
timer.start(mbgl::Duration::zero(), mbgl::Duration::zero(), [&] {
|
||||
secondTimeout = true;
|
||||
loop.stop();
|
||||
});
|
||||
|
||||
loop.run();
|
||||
|
||||
EXPECT_TRUE(secondTimeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user