// Create a thread that infinitely prints a message // The main thread also infinitely prints a message #include #include #include // This function is called to start thread execution. // It can be given any pointer as an argument. void *run_thread (void * argument) { char * s = "Hello from the other function!!\n"; while (1) { for (int i = 0; s[i] != '\0'; i++) { putchar(s[i]); } } } int main (void) { // Create a thread to do the run_thread code. pthread_t thread_id; pthread_create(&thread_id, NULL, run_thread, NULL); char * s = "Hello from the main\n"; while (1) { for (int i = 0; s[i] != '\0'; i++) { putchar(s[i]); } } return 0; }