struct pollfd *pollfd;
int i;
int num_rdy;
+ int high_prio;
pollfd = malloc(fd_pairs->num_pairs * sizeof(struct pollfd));
}
while(1) {
-
+ high_prio = 0;
+
num_rdy = poll(pollfd, fd_pairs->num_pairs, -1);
if(num_rdy == -1) {
perror("Poll error");
break;
case POLLPRI:
/* Take care of high priority channels first. */
+ high_prio = 1;
break;
- default:
+ }
}
- for(i=0;i<fd_pairs->num_pairs;i++) {
- switch(pollfd[i].revents) {
- case POLLIN:
- /* Take care of low priority channels. */
- break;
- default:
+ if(!high_prio) {
+ for(i=0;i<fd_pairs->num_pairs;i++) {
+ switch(pollfd[i].revents) {
+ case POLLIN:
+ /* Take care of low priority channels. */
+ break;
+ }
+ }
}
}