From 40ecb4b07c6bd1943c122f575a8f005793ef766b Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 18 Apr 2023 10:42:53 +0200 Subject: [PATCH] abuild-fetch: try harder to yield Try a bit harder to let other process aquire lock. This will hopefully reduce flakiness of testsuite when builder is under load. --- abuild-fetch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/abuild-fetch.c b/abuild-fetch.c index 4f77a72..442f644 100644 --- a/abuild-fetch.c +++ b/abuild-fetch.c @@ -34,6 +34,7 @@ THE SOFTWARE. #include #include #include +#include #include static char *program; @@ -181,7 +182,9 @@ fetch_done: release_lock(lockfd); // give other processes the chance to acquire the lock if they have the file open - sleep(0); + // sleep for a millisecond + const struct timespec ts = { .tv_sec = 0, .tv_nsec = 1000000}; + nanosleep(&ts, NULL); if (status == 0 || try_lock(lockfd)) unlink(lockfile);