Navigation


Changeset 1188:f40de74bd1c7 in freeDiameter for libfdproto/fifo.c


Ignore:
Timestamp:
Jun 10, 2013, 3:27:15 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Don't block PSM during failover

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdproto/fifo.c

    r1186 r1188  
    377377
    378378/* Post a new item in the queue */
    379 int fd_fifo_post_int ( struct fifo * queue, void ** item )
     379int fd_fifo_post_internal ( struct fifo * queue, void ** item, int skip_max )
    380380{
    381381        struct fifo_item * new;
     
    383383        struct timespec posted_on, queued_on;
    384384       
    385         TRACE_ENTRY( "%p %p", queue, item );
    386        
    387         /* Check the parameters */
    388         CHECK_PARAMS( CHECK_FIFO( queue ) && item && *item );
    389        
    390385        /* Get the timing of this call */
    391386        CHECK_SYS(  clock_gettime(CLOCK_REALTIME, &posted_on)  );
     
    394389        CHECK_POSIX(  pthread_mutex_lock( &queue->mtx )  );
    395390       
    396         if (queue->max) {
     391        if ((!skip_max) && (queue->max)) {
    397392                while (queue->count >= queue->max) {
    398393                        int ret = 0;
     
    460455        /* Done */
    461456        return 0;
     457}
     458
     459/* Post a new item in the queue */
     460int fd_fifo_post_int ( struct fifo * queue, void ** item )
     461{
     462        TRACE_ENTRY( "%p %p", queue, item );
     463       
     464        /* Check the parameters */
     465        CHECK_PARAMS( CHECK_FIFO( queue ) && item && *item );
     466       
     467        return fd_fifo_post_internal ( queue,item, 0 );
     468       
     469}
     470
     471/* Post a new item in the queue, not blocking */
     472int fd_fifo_post_noblock ( struct fifo * queue, void ** item )
     473{
     474        TRACE_ENTRY( "%p %p", queue, item );
     475       
     476        /* Check the parameters */
     477        CHECK_PARAMS( CHECK_FIFO( queue ) && item && *item );
     478       
     479        return fd_fifo_post_internal ( queue,item, 1 );
     480       
    462481}
    463482
Note: See TracChangeset for help on using the changeset viewer.