#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <pthread.h>

typedef struct {
  // put variables here that you want to share between threads
} Environment;

Environment *make_environment ()
{
  int i;

  Environment *env = (Environment *) malloc (sizeof (Environment));

  // initialize the contents of the environment

  return env;
}

void *entry (void *arg)
{
  // take the argument and cast it to be an Env pointer
  Environment *env = (Environment *) arg;

  // now you can access the shared variables

  pthread_exit (NULL);
}

main ()
{
  int i;
  Environment *env;

  // main is in charge of creating the shared environment
  env = make_environment ();

  // and passing it to the new thread as an argument

  ret = pthread_create (&child, NULL, entry, (void *) env);

  exit (0);
}
