mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-21 22:50:03 +00:00
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.
This commit is contained in:
parent
6ef57910ab
commit
40ecb4b07c
@ -34,6 +34,7 @@ THE SOFTWARE.
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user