/* EndLessLoop - Read until we get killed, blocking when can't read */ void EndLessLoop(void) { while(1) { ReadFvwmPipe(); } }
/****************************************************************************** EndLessLoop - Read and redraw until we get killed, blocking when can't read ******************************************************************************/ void EndLessLoop() { fd_set readset; struct timeval tv; while(1) { FD_ZERO(&readset); FD_SET(Fvwm_fd[1],&readset); FD_SET(x_fd,&readset); tv.tv_sec=0; tv.tv_usec=0; #ifdef __hpux if (!select(fd_width,(int *)&readset,NULL,NULL,&tv)) { XPending(dpy); FD_ZERO(&readset); FD_SET(Fvwm_fd[1],&readset); FD_SET(x_fd,&readset); select(fd_width,(int *)&readset,NULL,NULL,NULL); } #else if (!select(fd_width,&readset,NULL,NULL,&tv)) { XPending(dpy); FD_ZERO(&readset); FD_SET(Fvwm_fd[1],&readset); FD_SET(x_fd,&readset); select(fd_width,&readset,NULL,NULL,NULL); } #endif if (FD_ISSET(x_fd,&readset)) LoopOnEvents(); if (!FD_ISSET(Fvwm_fd[1],&readset)) continue; ReadFvwmPipe(); } }
/****************************************************************************** EndLessLoop - Read until we get killed, blocking when can't read ******************************************************************************/ void EndLessLoop() { fd_set readset; struct timeval tv; while(1) { FD_ZERO(&readset); FD_SET(Fvwm_fd[1],&readset); tv.tv_sec=0; tv.tv_usec=0; if (!select(fd_width,SELECT_TYPE_ARG234 &readset,NULL,NULL,&tv)) { FD_ZERO(&readset); FD_SET(Fvwm_fd[1],&readset); select(fd_width,SELECT_TYPE_ARG234 &readset,NULL,NULL,NULL); } if (!FD_ISSET(Fvwm_fd[1],&readset)) continue; ReadFvwmPipe(); } }
/****************************************************************************** MainEventLoop - Read and redraw until we die, blocking when can't read ******************************************************************************/ void MainEventLoop(void) { fd_set readset; while( !isTerminated ) { FD_ZERO(&readset); FD_SET(Fvwm_fd[1],&readset); FD_SET(x_fd,&readset); /* This code restyled after FvwmIconMan, which is simpler. * The biggest advantage over the original approach is * having one fewer select statements */ XFlush(dpy); if (select(fd_width,SELECT_TYPE_ARG234 &readset,NULL,NULL,NULL) > 0) { if (FD_ISSET(x_fd,&readset) || XPending(dpy)) LoopOnEvents(); if (FD_ISSET(Fvwm_fd[1],&readset)) ReadFvwmPipe(); } } /* while */ }