-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy paththreads.c
53 lines (44 loc) · 1.12 KB
/
threads.c
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
/* threads.c
*
* Definição das operações sobre o TAD threads e implementação das funçoes especificas
* sobre o arquivo main.c.
* esse TAD.
*/
#include "threads.h"
#include <stdlib.h>
void print_matriz(tipoDado matriz[][N])
{
tipoDado i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++)
printf("%lu", matriz[i][j]);
}
printf("\n");
}
void print_responsabilidade_thread(args * _args)
{
int i;
printf("\n____________________________________________________\n");
for(i = 0; i < threads - 1; i++) {
printf("\nMeu iDThread: %d\n", _args[i].id);
printf("As linhas x colunas que fiquei responsavel :)\n");
lst_print(_args[i].lista);
}
printf("\nJá eu iDThread: %d fiquei responsavel pelo Arquivo :)\n", i +1);
}
bool status_create(int status)
{
if (status) {
printf("Erro criando thread, retornou codigo %d\n", status );
return false;
}
return true;
}
FILE *open_arquivo(char * str, char * modo) {
FILE * arq; // Arquivo lógico
if ((arq = fopen(str, modo)) == NULL) {
fprintf(stderr, "Erro na abertura do arquivo %s\n", "filename");
exit(1);
}
return arq;
}