diff -up ./fifo.c.orig ./fifo.c --- ./fifo.c.orig 2004-03-29 12:21:29.000000000 +0300 +++ ./fifo.c 2004-03-29 12:38:04.000000000 +0300 @@ -12,23 +12,21 @@ static void make_pipe(int* pr,int* pw){ *pw=temp[1]; } -void mplayer_put_key(int code){ - fd_set rfds; - struct timeval tv; +static void set_nonblock_flag(int fd) { + int oldflags = fcntl(fd, F_GETFL, 0); + if (oldflags == -1) { + printf("Cannot get file status flags for fd %d!\n", fd); + } else { + if (fcntl(keyb_fifo_put, F_SETFL, oldflags | O_NONBLOCK) == -1) { + printf("Cannot set nonblocking mode for fd %d!\n", fd); + } + } +} - /* Watch stdin (fd 0) to see when it has input. */ - FD_ZERO(&rfds); - FD_SET(keyb_fifo_put, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - - //retval = select(keyb_fifo_put+1, &rfds, NULL, NULL, &tv); - if(select(keyb_fifo_put+1, NULL, &rfds, NULL, &tv)>0){ - write(keyb_fifo_put,&code,4); -// printf("*** key event %d sent ***\n",code); - } else { -// printf("*** key event dropped (FIFO is full) ***\n"); - } +void mplayer_put_key(int code){ + if (write(keyb_fifo_put,&code,4) == -1) { + printf("*** key event dropped (FIFO is full) ***\n"); + } } #else diff -up ./mplayer.c.orig ./mplayer.c --- ./mplayer.c.orig 2004-03-29 12:27:02.000000000 +0300 +++ ./mplayer.c 2004-03-29 12:29:43.000000000 +0300 @@ -1127,6 +1127,7 @@ current_module = "init_input"; mp_input_init(); #ifndef HAVE_NO_POSIX_SELECT make_pipe(&keyb_fifo_get,&keyb_fifo_put); +set_nonblock_flag(keyb_fifo_put); if(keyb_fifo_get > 0) mp_input_add_key_fd(keyb_fifo_get,1,NULL,NULL);