I am using select() function to listen the events from all file descriptors including stdin. The select function is always called in time but no matter whatever event happened and whatever fd triggers the event ,the select() function always returns 1.
void startSelecting()
{
printf("ready! start listening all events\n");
int current;
while(is_running){
do{
current=select(1000,&readset,NULL,NULL,NULL);
}while(current==-1&&errno==EINTR);
printf("file descriptor %d has event\n",current);
processEvents(current);
}
}
So,that is,it always prints "file descriptor 1 has event"... And,I am implementing C language Code. thank you guys