This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: //Create the threads. // These four dummy threads must be created first for (int j=0; j< 4; j++) pthread_create(&thdummy, NULL, dummy, NULL); // These are the worker threads for the computation pthread_create(&thread_id1, NULL, func1, NULL); pthread_create(&thread_id2, NULL, func2, NULL); pthread_create(&thread_id3, NULL, func3, NULL); //Wait for all threads terminate pthread_join(thread_id1, NULL); pthread_join(thread_id2, NULL); pthread_join(thread_id3, NULL); cout << "\nMain thread terminated" << endl; return 0; }...
View Full Document
This note was uploaded on 12/01/2010 for the course CS 2342 taught by Professor Dr during the Spring '10 term at HKU.
- Spring '10