2022-03-18 20:49:28 +01:00
|
|
|
#pragma once
|
2022-03-09 19:24:49 +01:00
|
|
|
#ifndef SERVERWORKER
|
|
|
|
|
#define SERVERWORKER
|
|
|
|
|
|
2022-03-18 20:49:28 +01:00
|
|
|
#include <apiFile.h>
|
|
|
|
|
#include <fileQueue.h>
|
2022-03-27 00:20:34 +01:00
|
|
|
#include <taglialegna.h>
|
2022-03-18 20:49:28 +01:00
|
|
|
|
|
|
|
|
// struttura dati che contiene gli argomenti da passare ai worker threads
|
|
|
|
|
typedef struct struct_thread {
|
2022-03-27 00:20:34 +01:00
|
|
|
int connfd;
|
|
|
|
|
int *quit;
|
|
|
|
|
int request_pipe;
|
2022-03-18 20:49:28 +01:00
|
|
|
queueT *q; // puntatore alla queue dei file
|
2022-03-27 00:20:34 +01:00
|
|
|
taglia_t *taglia; // puntatore alla struct del file di log
|
2022-03-18 20:49:28 +01:00
|
|
|
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;
|
|
|
|
|
|
2022-03-09 19:24:49 +01:00
|
|
|
// funzione eseguita dal generico Worker del pool di thread
|
|
|
|
|
void threadF(void *arg);
|
|
|
|
|
|
|
|
|
|
#endif /* SERVERWORKER */
|