clocksd: handle EINTR on read() (#21892)

* handle EINTR on read

* Update selfdrive/clocksd/clocksd.cc

Co-authored-by: Willem Melching <willem.melching@gmail.com>

Co-authored-by: Willem Melching <willem.melching@gmail.com>
pull/21895/head
Dean Lee 2021-08-10 20:42:46 +08:00 committed by GitHub
parent fb0d099362
commit 71a44cc275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -50,7 +50,10 @@ int main() {
uint64_t expirations = 0;
while (!do_exit && (err = read(timerfd, &expirations, sizeof(expirations)))) {
if (err < 0) break;
if (err < 0) {
if (errno == EINTR) continue;
break;
}
#else
// Just run at 1Hz on apple
while (!do_exit) {