void * Train ( void *arguments )
{
	TrainInfo	*train = (TrainInfo *)arguments;

	/* Sleep to simulate different arrival times */
	usleep (train->length*SLEEP_MULTIPLE);

	ArriveBridge (train);
	CrossBridge  (train);
	LeaveBridge  (train); 

	free (train);
	return NULL;
}
/*
 * This function is started for each thread created by the
 * main thread.  Each thread is given a TrainInfo structure
 * that specifies information about the train the individual 
 * thread is supposed to simulate.
 */
void * Train ( void *arguments )
{
  TrainInfo	*train = (TrainInfo *)arguments;

  /* Sleep to simulate different arrival times */
  usleep (train->length*SLEEP_MULTIPLE);

  ArriveBridge (train);
  CrossBridge  (train);
  LeaveBridge  (train); 

  /* I decided that the paramter structure would be malloc'd 
   * in the main thread, but the individual threads are responsible
   * for freeing the memory.
   *
   * This way I didn't have to keep an array of parameter pointers
   * in the main thread.
   */
  free (train);
  return NULL;
}