#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
#include<unistd.h>
#include<stdint.h>
void* threadFunct(void *arg){
while (1)
{
printf("Hallo. Ich bin Thread %ld.\n",pthread_self());
fflush(stdout);
sleep(1);
}
pthread_exit(NULL);
}
int main(){
int amntOfThreads= 2;
pthread_t thread[amntOfThreads];
for(int i = 0; i <= amntOfThreads -1; i++){
printf("Thread erzeugt, warte auf Beendigung...\n");
pthread_create(&thread[i],NULL,&threadFunct,NULL);
}
sleep(20);
return 0;
}