Merge pull request 'Fix busy loop in uart_handle_read causing high CPU usage and memory leaks' (#3) from Gl0w1amp/capnhook:master into master

Reviewed-on: https://gitea.tendokyu.moe/TeamTofuShop/capnhook/pulls/3
This commit is contained in:
Dniel97
2025-12-21 17:49:57 +00:00
+3
View File
@@ -200,6 +200,9 @@ static HRESULT uart_handle_read(struct uart *uart, struct irp *irp)
int requested = irp->read.nbytes;
if (uart->readable.pos < requested && uart->readable.pos == 0) {
/* Avoid a tight polling loop which causes performance issues
and massive memory leaks. Simulate hardware I/O latency. */
Sleep(1);
return E_PENDING;
}