Files
progettoso/src/serverWorker.h

34 lines
819 B
C
Raw Normal View History

2022-03-18 20:49:28 +01:00
#pragma once
#ifndef SERVERWORKER
#define SERVERWORKER
#include <pthread.h>
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-04-08 21:32:52 +02:00
#include <threadpool.h>
2022-03-18 20:49:28 +01:00
/* structure of the args to pass to the worker thread */
2022-03-18 20:49:28 +01:00
typedef struct struct_thread {
2022-04-04 22:31:14 +02:00
volatile int *quit;
2022-03-27 00:20:34 +01:00
int request_pipe;
2022-04-25 20:24:55 +02:00
long connfd;
queueT *q; /* pointer to file structure */
taglia_t *taglia; /* pointer to logfile handler */
threadpool_t *pool; /* pointer to threadpool */
2022-03-18 20:49:28 +01:00
pthread_mutex_t *lock;
waiting_t **waiting; /* pointer to clients waiting for a lock */
2022-03-18 20:49:28 +01:00
} threadT;
/* @brief Function executed by a worker thread to handle a single request from a
* client
*
* @param arg: type that holds all needed resources
*/
void threadF(void *arg);
#endif /* SERVERWORKER */