From 865c286c8c17594d33075e9696d85968eea8dd3b Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 25 Apr 2006 06:44:39 +0000 Subject: [PATCH] =?utf8?q?Bugfix=20para=20que=20no=20utilice=20como=20nomb?= =?utf8?q?re=20de=20variable=20una=20funci=C3=B3n=20ya=20existente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- practicas/practica2/P02e2311.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/practicas/practica2/P02e2311.cpp b/practicas/practica2/P02e2311.cpp index 18d1877..4e4aa43 100644 --- a/practicas/practica2/P02e2311.cpp +++ b/practicas/practica2/P02e2311.cpp @@ -26,17 +26,17 @@ using std::endl; /// Nombres de los procesos enum proc_t { PRODUCTOR, CONSUMIDOR }; -void producir(int pipe) +void producir(int p) { int val = rand(); - TEST(write(pipe, &val, sizeof(int))); + TEST(write(p, &val, sizeof(int))); cout << "Producido " << (int)val << endl; } -void consumir(int pipe) +void consumir(int p) { int val; - TEST(read(pipe, &val, sizeof(int))); + TEST(read(p, &val, sizeof(int))); cout << "Consumido " << val << endl; } @@ -57,14 +57,14 @@ int main(int argc, char *argv[]) max_iter = atoi(argv[2]); int mode = (proc == CONSUMIDOR) ? O_RDONLY : O_WRONLY; - int pipe = open(PIPE, mode); - TEST(pipe); + int p = open(PIPE, mode); + TEST(p); for (int i = 0; i < max_iter; ++i) { if (proc == PRODUCTOR) - producir(pipe); + producir(p); else - consumir(pipe); + consumir(p); sched_yield(); } -- 2.43.0