-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefinations.h
57 lines (37 loc) · 913 Bytes
/
definations.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <bits/pthreadtypes.h>
#include <unistd.h>
#include <malloc.h>
#include <stdlib.h>
#include <semaphore.h>
#define NUM_REQUESTS_BUFFER 100
#define NUM_THREADS 2
// Thread Pool structure
struct thread_pool_type
{
pthread_mutex_t BufferLock ;
pthread_cond_t EMPTY ;
};
// Scheduler structure
struct scheduler_type {
int BUFFER_STACK[NUM_REQUESTS_BUFFER];
struct queue *BUFFER_QUEUE ;
struct minHeap *BUFFER_HEAP ;
int curr_size;
};
// Arguments passed to workder threads
struct thread_arg {
struct scheduler_type * scheduler;
struct thread_pool_type * pool;
char *algorithm_type;
int requests_counter ;
};
// Generic Functions :
int request_parse_uri(char *uri, char *filename, char *cgiargs);
int get_filesize(int con_fd);
#endif