FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Pthread_Practice/Exerc1.cpp at main · HCuri1/Pthread_Practice · GitHub
HCuri1
/
Pthread_Practice
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Pthread_Practice
/
Exerc1.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (37 loc) · 847 Bytes
Breadcrumbs
Pthread_Practice
/
Exerc1.cpp
Copy path
File metadata and controls
69 lines (37 loc) · 847 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
58
59
60
61
62
63
64
65
66
67
68
69
#
include
<
iostream
>
#
include
<
pthread.h
>
using
namespace
std
;
int
vetor[
14
] = {
33
,
5676
,
234
,
4567
,
243
,
7567
,
238
,
434
,
11
,
443
,
572
,
553
,
233
,
775
};
int
g1, g2;
pthread_t
thread1, thread2;
void
*
greater1
(
void
*Arg){
g1= vetor[
0
];
for
(
int
i=
0
; i<
7
; i++){
if
(vetor[i]>g1){
g1=vetor[i];
}
}
return
0
;
}
void
*
greater2
(
void
*Arg){
g2= vetor[
7
];
for
(
int
i=
7
; i<
14
; i++){
if
(vetor[i] > g2){
g2 = vetor[i];
}
}
return
0
;
}
int
main
(){
pthread_create
(&thread1,
NULL
, greater1,
NULL
);
pthread_create
(&thread2,
NULL
, greater2,
NULL
);
pthread_join
(thread1,
NULL
);
pthread_join
(thread2,
NULL
);
if
(g1>g2){
cout<<
"
Greater:
"
<<g1<<endl;
}
else
{
cout<<
"
Greater:
"
<<g2<<endl;
}
return
0
;
}
Back
|
FazBrowse Home
|
New Git URL