#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
void *thread_function(void *arg)
{
for (int i = 0; i < 20; i++)
{
printf("hello\n");
sleep(1);
}
}
int main()
{
pthread_t mythread;
if (pthread_create(&mythread, NULL, thread_function, NULL))
{
printf("error");
abort();
}
if (pthread_join(mythread, NULL))
{
printf("error");
abort();
}
exit(0);
}