#include #include // para sleep #include "error_checks.h" // Argumentos para los threads typedef struct { int id; int fd; } thread_data_t; // Cuerpo threads lectores void * lector(void * args) { thread_data_t *data = (thread_data_t *)args; while(1) { // TODO sleep(4); } } // Programa principal int main () { pthread_t th1, th2; thread_data_t data1; thread_data_t data2; // abre fichero/dispositivo // TODO // Crea los threads CHK( pthread_create(&th1, NULL, lector, &data1) ); CHK( pthread_create(&th2, NULL, lector, &data2) ); // espera a que terminen CHK( pthread_join(th1, NULL) ); CHK( pthread_join(th2, NULL) ); printf ("main thread terminating\n"); exit (0); }