[wpiutil] uv::Async: Add direct call for no-parameter specialization (#3648)

This commit is contained in:
Peter Johnson
2021-10-20 08:44:33 -07:00
committed by GitHub
parent e56d6dea81
commit 138cbb94b2

View File

@@ -151,7 +151,12 @@ class Async<> final : public HandleImpl<Async<>, uv_async_t> {
*/
void Send() {
if (auto loop = m_loop.lock()) {
Invoke(&uv_async_send, GetRaw());
if (loop->GetThreadId() == std::this_thread::get_id()) {
// called from within the loop, just call the function directly
wakeup();
} else {
Invoke(&uv_async_send, GetRaw());
}
}
}