mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpinet] uv: Stop creating handles when closing loop (#5102)
This prevents EventLoopRunner::Stop() from hanging in the case when new handles are created after the async walk closes all the handles.
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
namespace wpi::uv {
|
||||
|
||||
std::shared_ptr<Check> Check::Create(Loop& loop) {
|
||||
if (loop.IsClosing()) {
|
||||
return nullptr;
|
||||
}
|
||||
auto h = std::make_shared<Check>(private_init{});
|
||||
int err = uv_check_init(loop.GetRaw(), h->GetRaw());
|
||||
if (err < 0) {
|
||||
@@ -20,6 +23,9 @@ std::shared_ptr<Check> Check::Create(Loop& loop) {
|
||||
}
|
||||
|
||||
void Check::Start() {
|
||||
if (IsLoopClosing()) {
|
||||
return;
|
||||
}
|
||||
Invoke(&uv_check_start, GetRaw(), [](uv_check_t* handle) {
|
||||
Check& h = *static_cast<Check*>(handle->data);
|
||||
h.check();
|
||||
|
||||
Reference in New Issue
Block a user