| 81 | |
| 82 | |
| 83 | int main(void) |
| 84 | { |
| 85 | TestThread *testThread[5]; Thread *thread[5]; int i; |
| 86 | |
| 87 | try |
| 88 | { |
| 89 | printf("Number of CPU cores in this system: %d\n", NumProcs()); |
| 90 | printf("Word size = %d-bit\n", (int)sizeof(long *) * 8); |
| 91 | |
| 92 | event.wait(); |
| 93 | |
| 94 | for(i = 0; i < 5; i++) |
| 95 | { |
| 96 | testThread[i] = new TestThread(i + 1); |
| 97 | thread[i] = new Thread(testThread[i]); |
| 98 | thread[i]->start(); |
| 99 | } |
| 100 | for(i = 0; i < 5; i++) thread[i]->stop(); |
| 101 | for(i = 0; i < 5; i++) thread[i]->checkError(); |
| 102 | } |
| 103 | catch(std::exception &e) |
| 104 | { |
| 105 | printf("Error in %s:\n%s\n", GET_METHOD(e), e.what()); |
| 106 | return -1; |
| 107 | } |
| 108 | |
| 109 | return 0; |
| 110 | } |