Navigation


Changeset 1112:d87cee14b051 in freeDiameter


Ignore:
Timestamp:
May 13, 2013, 7:50:26 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Fix core termination sequence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/core.c

    r1111 r1112  
    8484static int core_state_wait(enum core_state waitstate)
    8585{
    86         int ret;
     86        int ret = 0;
    8787        CHECK_POSIX( pthread_mutex_lock( &core_mtx ));
    8888        pthread_cleanup_push( fd_cleanup_mutex, &core_mtx );
    89         do {
     89        while (waitstate > core_state) {
    9090                CHECK_POSIX_DO(ret = pthread_cond_wait(&core_cnd, &core_mtx), break);
    91         } while (waitstate > core_state);
     91        }
    9292        pthread_cleanup_pop( 0 );
    9393        CHECK_POSIX( pthread_mutex_unlock( &core_mtx ));
     
    189189        }
    190190       
    191         LOG_D("libfdproto initialized.");
     191        LOG_N("libfdproto initialized.");
    192192       
    193193        /* Name this thread */
     
    305305        if (cur_state < CORE_RUNNING) {
    306306                core_shutdown();
     307                core_state_set(CORE_TERM);
    307308        } else if (cur_state == CORE_RUNNING) {
    308309                core_state_set(CORE_SHUTDOWN);
     
    323324        void * th_ret = NULL;
    324325       
     326        CHECK_FCT(core_state_wait(CORE_SHUTDOWN));
     327       
    325328        if (cur_state == CORE_TERM)
    326329                return 0;
    327330       
    328         CHECK_FCT(core_state_wait(CORE_SHUTDOWN));
    329        
    330331        /* Just wait for core_runner_thread to complete and return gracefully */
    331332        CHECK_POSIX(pthread_join(core_runner, &th_ret));
Note: See TracChangeset for help on using the changeset viewer.