Re: Concurrent processes and I/O multiplexing
- From: David Schwartz <davids@xxxxxxxxxxxxx>
- Date: Sun, 27 Jan 2008 16:28:29 -0800 (PST)
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
.
- References:
- Concurrent processes and I/O multiplexing
- From: openyourmind
- Concurrent processes and I/O multiplexing
- Prev by Date: Re: client server programming
- Next by Date: The Asylum BBS
- Previous by thread: Concurrent processes and I/O multiplexing
- Next by thread: sigaction and waitpid causes "interrupted system call" when calling fgets()
- Index(es):