Mercurial > hg > freeDiameter
diff libfdcore/core.c @ 1190:6a1042d8075b
Replace FDEV_TERMINATE events with calls to fd_core_shutdown to handle the core state properly
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Mon, 10 Jun 2013 16:44:18 +0800 |
parents | cc96a4dfb3d1 |
children | cec3e9b579e1 |
line wrap: on
line diff
--- a/libfdcore/core.c Mon Jun 10 16:23:09 2013 +0800 +++ b/libfdcore/core.c Mon Jun 10 16:44:18 2013 +0800 @@ -148,7 +148,7 @@ } break; - case FDEV_TERMINATE: + case FDEV_TERMINATE_INT: goto end; default: @@ -326,6 +326,8 @@ { enum core_state cur_state = core_state_get(); + LOG_F("Initiating freeDiameter shutdown sequence (%d)", cur_state); + if (cur_state < CORE_RUNNING) { /* Calling application must make sure the initialization is not ongoing in a separate thread... */ if (pthread_mutex_lock(&core_lock) != 0) { @@ -338,7 +340,7 @@ pthread_mutex_unlock(&core_lock); } else if (cur_state == CORE_RUNNING) { core_state_set(CORE_SHUTDOWN); - CHECK_FCT( fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE, 0, NULL) ); + CHECK_FCT( fd_event_send(fd_g_config->cnf_main_ev, FDEV_TERMINATE_INT, 0, NULL) ); } /* Other case, the framework is already shutting down */