// Plantilla programa que simula el control del volumen de liquido en un
// depósito

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

// Declaración de prototipos
void * controldep (void *);
void * llenado (void *);
void * alarma (void *);
void * reloj (void *);
void * lanzar (void *);

// Declaración de threads
pthread_t start, control, llenar, alar, tempo, thmain;

// Declaración del objeto atributo
pthread_attr_t attr;

// Declaración de variables globales
int volumen, umbral, caudal, caudalvaci, peligro;
unsigned long tiempo, tiempoej;



// Definición de funciones
int main (void)
{
	// Inicialización de variables

	// Inicialización del objeto atributo
	
	// Cambio del parámetro contentionscope para crear los threads
	
	// como threads de núcleo
	
	// Lectura de datos
	
	
	tiempoej = tiempoej * 20000000;
	pthread_create(&start, &attr, lanzar, NULL);
	printf("\n Soy main, he lanzado la ejecución y salgo\n");
	pthread_exit(NULL);
}


void * lanzar (void * arg)
{
		pthread_create (&tempo, &attr, reloj, NULL);
		pthread_create (&control, &attr, controldep,NULL);
		pthread_create (&llenar, &attr, llenado, NULL);
		pthread_create (&alar, &attr, alarma, NULL);
		pthread_exit (NULL);
}

// Plantilla para las funciones asociadas a los threads

void * llenado (void * arg)
{
	while (tiempo<tiempoej)
	{
	// Realizar tarea
	}
	pthread_exit(NULL);
}

void * controldep (void * arg)
{
	while (tiempo<tiempoej)
	{
	// Realizar tarea
	}
	pthread_exit(NULL);
}

void * alarma (void * arg)
{
	while (tiempo<tiempoej)
	{
	// Realizar tarea
	}
	pthread_exit(NULL);
}

void * reloj (void * arg)
{
	while (tiempo<tiempoej)
	{
	// Realizar tarea
	}
	pthread_exit(NULL);
}

