server : replace sleep with condition variables (#4673)
The server currently schedules tasks using a sleep(5ms) busy loop. This adds unnecessary latency since most sleep implementations do a round up to the system scheduling quantum (usually 10ms). Other libc sleep impls spin for smaller time intervals which results in the server's busy loop consuming all available cpu. Having the explicit notify() / wait() code also helps aid in the readability of the server code. See mozilla-Ocho/llamafile@711344b
J
Justine Tunney committed
db49ff8ed7f0bb201176703441cc02911b08ef2a
Parent: 60f55e8
Committed by GitHub <noreply@github.com>
on 12/29/2023, 2:24:12 PM