Fix race in sys_net select and poll

This commit is contained in:
RipleyTom 2024-06-13 21:06:12 +02:00 committed by Elad Ashkenazi
parent caf81f1367
commit feff2ba09e
2 changed files with 3 additions and 15 deletions

View File

@ -1412,14 +1412,8 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr<sys_net_pollfd> fds, s32 n
return {}; return {};
} }
std::lock_guard nw_lock(g_fxo->get<network_context>().mutex_thread_loop);
if (signaled)
{
break;
}
has_timedout = network_clear_queue(ppu); has_timedout = network_clear_queue(ppu);
ppu.state -= cpu_flag::signal;
break; break;
} }
} }
@ -1651,14 +1645,8 @@ error_code sys_net_bnet_select(ppu_thread& ppu, s32 nfds, vm::ptr<sys_net_fd_set
return {}; return {};
} }
std::lock_guard nw_lock(g_fxo->get<network_context>().mutex_thread_loop);
if (signaled)
{
break;
}
has_timedout = network_clear_queue(ppu); has_timedout = network_clear_queue(ppu);
ppu.state -= cpu_flag::signal;
break; break;
} }
} }

View File

@ -96,9 +96,9 @@ void base_network_thread::wake_threads()
if (!ppu_to_awake.empty()) if (!ppu_to_awake.empty())
{ {
ppu_to_awake.clear();
lv2_obj::awake_all(); lv2_obj::awake_all();
} }
ppu_to_awake.clear();
} }
p2p_thread::p2p_thread() p2p_thread::p2p_thread()