Api for managing files
This commit is contained in:
@ -149,8 +149,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
|
||||
volatile int quit = 0;
|
||||
sig_atomic_t stopNewConnections = 0; // true to stop new connections
|
||||
sig_atomic_t numberOfConnections = 0;
|
||||
volatile int stopNewConnections = 0; // true to stop new connections
|
||||
volatile int numberOfConnections = 0;
|
||||
|
||||
while(!quit) {
|
||||
// copio il set nella variabile temporanea per la select
|
||||
|
||||
@ -183,14 +183,13 @@ int parser(int len, char *command, queueT *queue, long fd_c, logT* logFileT, pth
|
||||
removeFile(token2, queue, fd_c, logFileT, lock, waiting);
|
||||
goto _parser_end;
|
||||
}
|
||||
|
||||
goto _parser_cleanup; // nessun comando riconosciuto
|
||||
|
||||
_parser_end:
|
||||
free(command);
|
||||
return 0;
|
||||
// se arrivo qui non ho riconosciuto il comando
|
||||
|
||||
_parser_cleanup:
|
||||
free(command);
|
||||
return -1;
|
||||
|
||||
_parser_end:
|
||||
free(command);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,6 +1,20 @@
|
||||
#pragma once
|
||||
#ifndef SERVERWORKER
|
||||
#define SERVERWORKER
|
||||
|
||||
#include <apiFile.h>
|
||||
#include <fileQueue.h>
|
||||
|
||||
// struttura dati che contiene gli argomenti da passare ai worker threads
|
||||
typedef struct struct_thread {
|
||||
long *args;
|
||||
queueT *q; // puntatore alla queue dei file
|
||||
// logT *logFileT; // puntatore alla struct del file di log
|
||||
threadpool_t *pool; // puntatore alla threadpool
|
||||
pthread_mutex_t *lock;
|
||||
waitingT **waiting; // puntatore ai client in attesa di ottenere la lock su un file
|
||||
} threadT;
|
||||
|
||||
// funzione eseguita dal generico Worker del pool di thread
|
||||
void threadF(void *arg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user