- Define two variables of the type pthread_t to store two thread identifiers:
pthread_t tid1, tid2;
- Invoke the pthread_create function twice to create two threads, and assign the identifiers that we created in the previous step. The two threads are created with the default attributes. Specify two respective functions that need to be executed for the two threads:
pthread_create(&tid1,NULL,runThread1,NULL);pthread_create(&tid2,NULL,runThread2,NULL);
- In the function of the first thread, display a text message to indicate that the first thread was created and is running:
printf("Running Thread 1\n");
- To indicate the execution of the first thread, execute a for loop in the first function to display the sequence of numbers from ...