#include <stdio.h>
#include <pthread.h>


void pidof_thread(void *name)
{
  printf("Nachricht von Thread mit der  ID %ld\n",pthread_self());
  pthread_exit((void *) 0);
}

int main()
{
  pthread_t th[3];
  int i;

  for(i=0; i<3; i++)
   {
    if(pthread_create(&th[i], NULL, (void *)&pidof_thread, (void *)NULL) != 0)
      {
       fprintf(stderr, "Fehler beim Erzeugen eines Threads.!?!?!\n");
       exit(0);
      }
   }

  for(i=0; i<3; i++);
    pthread_join(th[i], NULL);

  return 0;
}