Re: Concurrent processes and I/O multiplexing



On Jan 25, 2:38 pm, openyourmind <openyourmi...@xxxxxxxxx> wrote:

FD_ZERO(&rfds);
FD_SET (pipe2[0], &rfds);
FD_SET (STDIN_FILENO, &rfds);

sem_signal(sem2);//OK: PROCESSO_1,GIVE ME NEW DATA

while(1) {

signal(SIGALRM, handle_signal);

select (pipe2[0]+1, &rfds, NULL, NULL, NULL);

This is one of the two most common 'select' mistakes. The 'rdfs' set
is both an input and an output, so when you call 'select' the second
time, it contains the wrong thing (the output from the first select).

DS
.