Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/gcov/gcov-threads-1.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
17 for (uint32_t i = starti; i < NR; ++i) | 17 for (uint32_t i = starti; i < NR; ++i) |
18 pthread_mutex_lock (&cndMs[i]); | 18 pthread_mutex_lock (&cndMs[i]); |
19 for (int32_t i = NR - 1; i >= starti; --i) | 19 for (int32_t i = NR - 1; i >= starti; --i) |
20 pthread_mutex_unlock (&cndMs[i]); | 20 pthread_mutex_unlock (&cndMs[i]); |
21 } | 21 } |
22 | |
23 return 0; | |
22 } | 24 } |
23 int main(int argc, char **argv) { | 25 int main(int argc, char **argv) { |
24 for (unsigned i = 0; i < NR; i++) | 26 for (unsigned i = 0; i < NR; i++) |
25 cndMs[i] = PTHREAD_MUTEX_INITIALIZER; | 27 cndMs[i] = PTHREAD_MUTEX_INITIALIZER; |
26 | 28 |
29 | 31 |
30 for (int i = 0; i < NR; i++) | 32 for (int i = 0; i < NR; i++) |
31 { | 33 { |
32 ids[i] = i; | 34 ids[i] = i; |
33 int r = pthread_create (&t[i], NULL, ContentionNoDeadlock_thread, &ids[i]); | 35 int r = pthread_create (&t[i], NULL, ContentionNoDeadlock_thread, &ids[i]); |
34 assert (r == 0); /* count(5) */ | 36 assert (r == 0); /* count(5*) */ |
35 } | 37 } |
36 | 38 |
37 int ret; | 39 int ret; |
38 for (int i = 0; i < NR; i++) | 40 for (int i = 0; i < NR; i++) |
39 { | 41 { |
40 int r = pthread_join (t[i], (void**)&ret); | 42 int r = pthread_join (t[i], (void**)&ret); |
41 assert (r == 0); /* count(5) */ | 43 assert (r == 0); /* count(5*) */ |
42 } | 44 } |
43 | 45 |
44 return 0; /* count(1) */ | 46 return 0; /* count(1) */ |
45 } | 47 } |
46 | 48 |