- printf("Urgent read on fd %d\n", pollfd[i].fd);
- /* Take care of high priority channels first. */
- high_prio = 1;
- ret |= read_subbuffer(&fd_pairs->pair[i]);
+ if(pthread_mutex_trylock(&fd_pairs->pair[i].mutex) == 0) {
+ printf("Urgent read on fd %d\n", pollfd[i].fd);
+ /* Take care of high priority channels first. */
+ high_prio = 1;
+ /* it's ok to have an unavailable subbuffer */
+ ret = read_subbuffer(&fd_pairs->pair[i]);
+ if(ret == -EAGAIN) ret = 0;
+ else if(ret)
+ printf("Error in read_subbuffer : %s\n", strerror(ret));
+ ret = pthread_mutex_unlock(&fd_pairs->pair[i].mutex);
+ if(ret)
+ printf("Error in mutex unlock : %s\n", strerror(ret));
+ }