Skip to content

Commit f0a274e

Browse files
committed
esp32/network_ppp: Reduce PPP thread CPU usage.
Reduces the CPU usage by the PPP thread by sleeping for one tick if there was nothing to read; preventing the loop using 100% CPU when the read operation has a zero timeout and immediately returns. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
1 parent 3883f29 commit f0a274e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ports/esp32/network_ppp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ static void pppos_client_task(void *self_in) {
104104
ppp_if_obj_t *self = (ppp_if_obj_t *)self_in;
105105
uint8_t buf[256];
106106

107-
while (ulTaskNotifyTake(pdTRUE, 0) == 0) {
107+
int len = 0;
108+
while (ulTaskNotifyTake(pdTRUE, len <= 0) == 0) {
108109
int err;
109-
int len = mp_stream_rw(self->stream, buf, sizeof(buf), &err, 0);
110+
len = mp_stream_rw(self->stream, buf, sizeof(buf), &err, 0);
110111
if (len > 0) {
111112
pppos_input_tcpip(self->pcb, (u8_t *)buf, len);
112113
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy