Added file queue handling

This commit is contained in:
elvis
2022-03-15 00:30:04 +01:00
parent b4ca73b8d6
commit a72f0a0fad
7 changed files with 993 additions and 51 deletions

View File

@ -83,25 +83,6 @@ static inline void print_error(const char * str, ...) {
free(p);
}
/**
* \brief Controlla se la stringa passata come primo argomento e' un numero.
* \return 0 ok 1 non e' un numbero 2 overflow/underflow
*/
static inline int isNumber(const char* s, long* n) {
if (s==NULL) return 1;
if (strlen(s)==0) return 1;
char* e = NULL;
errno=0;
long val = strtol(s, &e, 10);
if (errno == ERANGE) return 2; // overflow/underflow
if (e != NULL && *e == (char)0) {
*n = val;
return 0; // successo
}
return 1; // non e' un numero
}
#define LOCK(l) if (pthread_mutex_lock(l)!=0) { \
fprintf(stderr, "ERRORE FATALE lock\n"); \
pthread_exit((void*)EXIT_FAILURE); \