Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/fifo.c

    r1093 r1104  
    412412        CHECK_MALLOC_DO(  new = malloc (sizeof (struct fifo_item)) , {
    413413                        pthread_mutex_unlock( &queue->mtx );
     414                        return ENOMEM;
    414415                } );
    415416       
     
    470471        ASSERT( ! FD_IS_LIST_EMPTY(&queue->list) );
    471472       
    472         fi = (struct fifo_item *)queue->list.next;
     473        fi = (struct fifo_item *)(queue->list.next);
     474        ret = fi->item.o;
    473475        fd_list_unlink(&fi->item);
    474476        queue->count--;
    475477        queue->total_items++;
    476         ret = fi->item.o;
    477478       
    478479        /* Update the timings */
     
    578579static int fifo_tget ( struct fifo * queue, void ** item, int istimed, const struct timespec *abstime)
    579580{
    580         int timedout = 0;
    581581        int call_cb = 0;
     582        int ret = 0;
    582583       
    583584        /* Check the parameters */
     
    598599                return EPIPE;
    599600        }
    600                
     601       
    601602        if (queue->count > 0) {
    602603                /* There are items in the queue, so pick the first one */
     
    604605                call_cb = test_l_cb(queue);
    605606        } else {
    606                 int ret = 0;
    607607                /* We have to wait for a new item */
    608608                queue->thrs++ ;
     
    618618                        goto awaken;  /* test for spurious wake-ups */
    619619               
    620                 if (istimed && (ret == ETIMEDOUT)) {
    621                         timedout = 1;
    622                 } else {
    623                         /* Unexpected error condition (means we need to debug) */
    624                         ASSERT( ret == 0 /* never true */ );
    625                 }
     620                /* otherwise (ETIMEDOUT / other error) just continue */
    626621        }
    627622       
     
    634629       
    635630        /* Done */
    636         return timedout ? ETIMEDOUT : 0;
     631        return ret;
    637632}
    638633
Note: See TracChangeset for help on using the changeset viewer.