Código:
muchas gracias pro su ayuda de antemano
# include <stdio.h>
# include <time.h>
# include <unistd.h>
# include <stdlib.h>
# include <pthread.h>
# include <sys/types.h>
char *msg = "";
FILE *logFile;
logFile = fopen("\callcenter.log", " a " );
fprintf(logFile,"%s\n", msg);
fclose(logFile);
time_t tiempo = time(0);
struct tm *tlocal = localtime(&tiempo);
char output[20];
strftime(output,20,"%d/%m/%y %H:%M:%S",tiempo);
struct cliente {
int idC = 0, tiempo_espera = 0;
thread_t thread_id;
struct tm *hora_llamada = NULL;
struct tm *hola_colgada = NULL;
};
struct agente {
int idA = 0, t_atencion = 0;
bool ocupado = FALSE ;
struct tm *hora_atencion = NULL;
};
struct cliente listaClientes [10];
void *tareaAgente(void *ptr) {
int x;
pthread_mutex_lock(&mutex);
printf("Comienzo tarea Agente\n");
srand((int)pthread_self());
x=1+(int)(30.0*rand()/ RAND_MAX +10.0); // X es un n√∫mero aleatorio entre 10 y 30
sleep(x);
printf("Fin tarea Agente : Tiempo ejecucion %d\n",x);
pthread_mutex_unlock(&mutex);
}
struct agente agenteA,agenteB,agenteC;
int main(void){
;// crea un agente de tipo agente
pthread_t agenteA,agenteB,agenteC
pthread_create (&agenteA, NULL, tareaAgente, "Ejecuta el agenteA");
pthread_create (&agenteB, NULL, tareaAgente, "Ejecuta el agenteB");
pthread_create (&agenteC, NULL, tareaAgente, "Ejecuta el agenteC");
}


