This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int *reservaMemoria(int n); | |
void introducirDatos(int *vector, int n); | |
void visualizarDatos(int *vector, int n); | |
int asc(const void *e1 ,const void *e2); | |
int desc(const void *e1 ,const void *e2); | |
void imprimir(int n); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
#include <semaphore.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
/*Variables Globales*/ | |
int rc=0; | |
int wc=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pthread.h> | |
#include <semaphore.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
/*Variables Globales*/ | |
int rc=0; | |
typedef struct datos{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sem_t mujeres, hombres, contadores | |
boolean hombres := false, mujeres := false // hombres/mujeres dentro (booleano) | |
int personasdentro := 0 | |
int nh := 0, nm := 0 // nh-> hombres esperando, nm-> mujeres esperando | |
init(contadores, 1) | |
init(hombres, 0) | |
init(mujeres, 0) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sem_t fumador1,fumador2,fumador3,estanquero | |
struct nfumador {ingrediente}; | |
init(fumador1,0) | |
init(fumador2,0) | |
init(fumador3,0) | |
init(estanquero,1) | |
------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <semaphore.h> | |
#include <iostream> | |
#include <time.h> | |
using namespace std; | |
struct nFumador{ int ingrediente; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _CONTORNOGRAFICO2D_HPP //Guardas de inclusión | |
#define _CONTORNOGRAFICO2D_HPP | |
//Includes | |
#include <cstring> | |
#include <iostream> | |
#include <cstdlib> | |
#include "PuntoGrafico2D.hpp" | |
#include "listaPuntoGrafico2D.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _LISTAPUNTOGRAFICO2D_HPP //Guardas de inclusión | |
#define _LISTAPUNTOGRAFICO2D_HPP | |
//Includes | |
#include <cstring> | |
#include <iostream> | |
#include <cstdlib> | |
#include "contornoGrafico2D.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void * estanco(void *arg){ | |
//Esta funcion la ejecutara la hebra estanquero | |
// inicializa semilla aleatoria | |
srand(time(NULL)); | |
while(1){ | |
/** falta sincronizacion para que el estanquero no se adelante si el ultimo fumador no termino de liar */ | |
sem_wait(&estanquero); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <semaphore.h> | |
#include <iostream> | |
#include <time.h> | |
using namespace std; | |
struct nfumador{ int ingrediente; }; |
NewerOlder