BBA/HLE: Sleep when no data is received

This commit is contained in:
Sepalani 2024-02-03 15:20:29 +04:00
parent 05ed1a2fae
commit 73aa8c50a2
1 changed files with 10 additions and 3 deletions

View File

@ -678,14 +678,17 @@ bool CEXIETHERNET::BuiltInBBAInterface::SendFrame(const u8* frame, u32 size)
void CEXIETHERNET::BuiltInBBAInterface::ReadThreadHandler(CEXIETHERNET::BuiltInBBAInterface* self)
{
std::size_t datasize = 0;
while (!self->m_read_thread_shutdown.IsSet())
{
// make thread less cpu hungry
std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (datasize == 0)
{
// Make thread less CPU hungry
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
if (!self->m_read_enabled.IsSet())
continue;
std::size_t datasize = 0;
u8 wp = self->m_eth_ref->page_ptr(BBA_RWP);
const u8 rp = self->m_eth_ref->page_ptr(BBA_RRP);
@ -711,6 +714,10 @@ void CEXIETHERNET::BuiltInBBAInterface::ReadThreadHandler(CEXIETHERNET::BuiltInB
self->m_queue_read++;
self->m_queue_read &= 15;
}
else
{
datasize = 0;
}
// Check network stack references
self->PollData(&datasize);