Navigation


Changeset 1328:81af4f5a517a in freeDiameter for libfdcore


Ignore:
Timestamp:
Nov 27, 2017, 11:22:42 PM (6 years ago)
Author:
Thomas Klausner <tk@giga.or.at>
Branch:
default
Phase:
public
Message:

Improve shutdown.

Should generate less messages that can not get sent out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/routing_dispatch.c

    r1301 r1328  
    10751075                struct msg * msg;
    10761076       
    1077                 /* Test the current order */
    1078                 {
    1079                         int must_stop;
    1080                         CHECK_POSIX_DO( pthread_mutex_lock(&order_state_lock), { ASSERT(0); } ); /* we lock to flush the caches */
    1081                         must_stop = (order_val == STOP);
    1082                         CHECK_POSIX_DO( pthread_mutex_unlock(&order_state_lock), { ASSERT(0); } );
    1083                         if (must_stop)
    1084                                 goto end;
    1085                        
    1086                         pthread_testcancel();
    1087                 }
    1088                
    1089                 /* Ok, we are allowed to run */
    1090                
    10911077                /* Get the next message from the queue */
    10921078                {
     
    10981084                       
    10991085                        ret = fd_fifo_timedget ( queue, &msg, &ts );
    1100                         if (ret == ETIMEDOUT)
    1101                                 /* loop, check if the thread must stop now */
     1086                        if (ret == ETIMEDOUT) {
     1087                                /* Test the current order */
     1088                                {
     1089                                        int must_stop;
     1090                                        CHECK_POSIX_DO( pthread_mutex_lock(&order_state_lock), { ASSERT(0); } ); /* we lock to flush the caches */
     1091                                        must_stop = (order_val == STOP);
     1092                                        CHECK_POSIX_DO( pthread_mutex_unlock(&order_state_lock), { ASSERT(0); } );
     1093                                        if (must_stop)
     1094                                                goto end;
     1095
     1096                                        pthread_testcancel();
     1097                                }
     1098                                /* Ok, we are allowed to continue */
    11021099                                continue;
     1100                        }
    11031101                        if (ret == EPIPE)
    11041102                                /* The queue was destroyed, we are probably exiting */
Note: See TracChangeset for help on using the changeset viewer.