| 63 | #define THREAD_COUNT 4 |
| 64 | |
| 65 | int main() { |
| 66 | pthread_t thread [THREAD_COUNT]; |
| 67 | |
| 68 | int attempts = 10000000/THREAD_COUNT; |
| 69 | int count = 0; |
| 70 | for (int i = 0; i < THREAD_COUNT; i++) { |
| 71 | pthread_create(&thread[i], NULL, get_happycoins, &attempts); |
| 72 | } |
| 73 | for (int j = 0; j < THREAD_COUNT; j++) { |
| 74 | struct happy_result * result; |
| 75 | pthread_join(thread[j], (void **)&result); |
| 76 | count += result->count; |
| 77 | for (int k = 0; k < result->count; k++) { |
| 78 | printf("%" PRIu64 " ", result->nums[k]); |
| 79 | } |
| 80 | } |
| 81 | printf("\ncount %d\n", count); |
| 82 | return 0; |
| 83 | } |
nothing calls this directly
no outgoing calls
no test coverage detected