-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paththreads.h
51 lines (38 loc) · 985 Bytes
/
threads.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
/* threads.h
*
* Definição do TAD para operação com threads e funçoes especificas
* sobre o arquivo main.c, como também os protótipo das operações sobre
* esse TAD.
*
*/
#ifndef _THREADS_H
#define _THREADS_H
#include <stdbool.h>
#include <stdio.h>
#include "lista.h"
#include "main.h"
#include <pthread.h>
#define threads 4 //Defina a quantidade de threads a serem utilizadas.
#define N 1000 //DEFINA O TAMANO DA MATRIZ AQUI
/*semaphoro controle de IO para thread especificas de IO*/
#define WAIT 0
#define READY 1
#define EXECUTED -1
typedef unsigned long long int tipoDado;
typedef struct argsArq * ptrArgsArq;
struct argsArq {
pthread_t thread;
int statusArq[N];
int id;
FILE * arq;
};
typedef struct {
pthread_t thread;
lst_ptr lista;
int id;
ptrArgsArq ptrArq;
}args;
void print_matriz(tipoDado matriz[][N]);
FILE *open_arquivo(char * str, char * modo);
void print_responsabilidade_thread(args * _args);
#endif //_THREADS_H