-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.h
48 lines (41 loc) · 1.29 KB
/
main.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
#ifndef _MAIN_H
#define _MAIN_H
/**
* This file contains all the global variables used throughout the program.
*/
// If d option is used, print_all is true, else false.
extern bool print_all;
// The number of calculations threads allowed by the command-line argument
extern int max_threads;
// The number of files
extern int count_files;
// The buffer size
extern buffer_size;
// The buffer
extern buffer_node_t *buffer;
// The head of the buffer
extern buffer_node_t *head;
// The tail of the buffer
extern buffer_node_t *tail;
// The number of opened files;
extern int is_reading;
// The best average
extern double best_average;
// The fractal with the best average
extern fractal_t *best;
extern pthread_mutex_t mutex_buffer;
extern pthread_mutex_t mutex_closing;
extern pthread_mutex_t mutex_best;
extern sem_t empty;
extern sem_t full;
extern pthread_t *read_threads;
extern pthread_t *compute_threads;
/**
* Checks for : -d option and set print_all to true if detected,
* --maxthreads n option and set max_threads to n if detected,
* number of input files and set is_reading value accordingly.
* @argc: number of input arguments argv.
* @argv: command line input arguments (includes name of executable).
*/
static void get_options_and_is_reading(int argc, char *argv[]);
#endif