提交 34c7fd1e authored 作者: João Mesquita's avatar João Mesquita

Wait for the core to shutdown upon exit.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@16103 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 8690f6a9
...@@ -9,19 +9,12 @@ FSHost::FSHost(QObject *parent) : ...@@ -9,19 +9,12 @@ FSHost::FSHost(QObject *parent) :
switch_core_set_globals(); switch_core_set_globals();
} }
FSHost::~FSHost()
{
switch_status_t destroy_status;
/* When the runtime loop exits, its time to shutdown */
destroy_status = switch_core_destroy();
wait();
}
void FSHost::run(void) void FSHost::run(void)
{ {
switch_core_flag_t flags = SCF_USE_SQL; switch_core_flag_t flags = SCF_USE_SQL;
const char *err = NULL; const char *err = NULL;
switch_bool_t console = SWITCH_FALSE; switch_bool_t console = SWITCH_FALSE;
switch_status_t destroy_status;
/* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */ /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
printf("Initializing core...\n"); printf("Initializing core...\n");
...@@ -38,6 +31,9 @@ void FSHost::run(void) ...@@ -38,6 +31,9 @@ void FSHost::run(void)
*/ */
switch_core_runtime_loop(!console); switch_core_runtime_loop(!console);
fflush(stdout); fflush(stdout);
/* When the runtime loop exits, its time to shutdown */
destroy_status = switch_core_destroy();
} }
switch_status_t FSHost::sendCmd(const char *cmd, const char *args, QString *res) switch_status_t FSHost::sendCmd(const char *cmd, const char *args, QString *res)
......
...@@ -9,7 +9,6 @@ class FSHost : public QThread ...@@ -9,7 +9,6 @@ class FSHost : public QThread
Q_OBJECT Q_OBJECT
public: public:
explicit FSHost(QObject *parent = 0); explicit FSHost(QObject *parent = 0);
~FSHost(void);
switch_status_t sendCmd(const char *cmd, const char *args, QString *res); switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
protected: protected:
......
...@@ -18,6 +18,9 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -18,6 +18,9 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete ui; delete ui;
QString res;
this->fshost->sendCmd("fsctl", "shutdown", &res);
this->fshost->wait();
} }
void MainWindow::fshostReady() void MainWindow::fshostReady()
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论