wpiutil: uv: Add LoopClosing status to Handle (#1647)

Useful for EventLoopRunner to know if a stop is requested, or close is happening for another reason.
This commit is contained in:
Thad House
2019-05-05 17:38:56 -07:00
committed by Peter Johnson
parent 7cd6e2e7fa
commit 620bec9cae
2 changed files with 28 additions and 1 deletions

View File

@@ -49,7 +49,10 @@ EventLoopRunner::~EventLoopRunner() { Stop(); }
void EventLoopRunner::Stop() {
ExecAsync([](uv::Loop& loop) {
// close all handles; this will (eventually) stop the loop
loop.Walk([](uv::Handle& h) { h.Close(); });
loop.Walk([](uv::Handle& h) {
h.SetLoopClosing(true);
h.Close();
});
});
m_owner.Join();
}