Make commands that fail, fail faster and move first idle check before first sleep, but after an initial 300ms sleep

This commit is contained in:
Konstantin Pereiaslov
2023-05-19 22:56:22 -05:00
parent 83c82b352e
commit 482fb66e54
5 changed files with 68 additions and 14 deletions

15
sleep_utils.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef SLEEP_UTILS_H
#define SLEEP_UTILS_H
#include <time.h>
#include <errno.h>
/**
* Sleeps for the specified number of milliseconds unless interrupted by a signal.
*
* @param milliseconds The number of milliseconds to sleep.
* @return 0 on success, -1 on failure or being interrupted by a signal (sets errno to EINVAL if milliseconds is negative).
*/
int sleep_for_milliseconds(long milliseconds);
#endif /* SLEEP_UTILS_H */