/*
 * hilo1.c
 * 
 * Copyright 2023 grchere <grchere@grcnet>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 * 
 * Problema: termina main() y hay hilo que tal vez no hayan
 * comenzando si quiera a ejecutarse.
 * Si finaliza main() finalizan todos sus hilos
 */


#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void *tarea1(void *);
void *tarea2(void *);

int main(int argc, char **argv)
{
	pthread_t t1,t2;
	int rc;
	printf("main(): creo y lanzo hilos\n");
	rc = pthread_create(&t1,NULL,tarea1,NULL);
	rc = pthread_create(&t2,NULL,tarea2,NULL);
	printf("main():fin rc=%d\n",rc);
	return 0;
}

void *tarea1(void *p) {
	
	printf("tarea1\n");
	pthread_exit(NULL);
	
}
void *tarea2(void *p) {
	
	printf("tarea2\n");
	pthread_exit(NULL);
	
}
