// Exemplo de uso de threads Posix em C no Linux
// Compilar com gcc exemplo.c -o exemplo -lpthread
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define NUM_THREADS 5
// cada thread vai executar esta função
void *print_hello (void *threadid)
{
   printf ("%ld: Hello World!\n", (long) threadid);
   sleep(5);
   printf ("%ld: Bye bye World!\n", (long) threadid);
   pthread_exit (NULL);
   // encerra esta thread
}
