bad_threads.c 421 Bytes
#include <stdio.h>
#include <pthread.h>

void* worker1(void* arg){
		
 
	while(1){

		write (1, "11111111\n", 9);
		sleep(3);
	} 
}

void* worker2(void* arg){
	

	while(1){
		write(1, "22222222\n", 9);
		sleep(3);
	}
}

int main(){

	pthread_t tid1, tid2;

	pthread_create(&tid1, NULL, worker1, NULL); 
	pthread_create(&tid2, NULL, worker2, NULL); 
	pthread_join (tid1, NULL);
	pthread_join (tid2, NULL);
	return 0;

}