1
0
mirror of https://github.com/p2r3/bareiron.git synced 2025-10-02 07:35:08 +02:00

make esp task yielding more consistent and reduce overhead

This commit is contained in:
p2r3
2025-08-20 15:21:02 +03:00
parent 5f3dcc56f9
commit 8936eb32db
6 changed files with 36 additions and 23 deletions

View File

@@ -47,8 +47,7 @@ ssize_t recv_all (int client_fd, void *buf, size_t n, uint8_t require_first) {
ssize_t r = recv(client_fd, p + total, n - total, 0);
if (r < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
// spin until data arrives
wdt_reset();
task_yield();
continue;
} else {
return -1; // real error
@@ -78,7 +77,7 @@ ssize_t send_all (int client_fd, const void *buf, size_t len) {
return -1;
}
if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
wdt_reset();
task_yield();
continue;
}
return -1;