[Add] api.ctp: terminate task queue when exit() is called

This commit is contained in:
nanoric 2019-02-18 05:10:51 -04:00
parent 262eb2498f
commit 66edd75a2b
2 changed files with 4 additions and 6 deletions

View File

@ -570,7 +570,8 @@ int MdApi::join()
int MdApi::exit()
{
this->active = false;
//this->task_thread.join();
this->task_queue.terminate();
this->task_thread.join();
this->api->RegisterSpi(NULL);
this->api->Release();
@ -808,8 +809,6 @@ public:
PYBIND11_MODULE(vnctpmd, m)
{
PyEval_InitThreads(); //导入时运行保证先创建GIL
class_<MdApi, PyMdApi> mdapi(m, "MdApi");
mdapi
.def(init<>())

View File

@ -7921,7 +7921,8 @@ int TdApi::join()
int TdApi::exit()
{
this->active = false;
//this->task_thread.join();
this->task_queue.terminate();
this->task_thread.join();
this->api->RegisterSpi(NULL);
this->api->Release();
@ -10631,8 +10632,6 @@ public:
PYBIND11_MODULE(vnctptd, m)
{
PyEval_InitThreads(); //导入时运行保证先创建GIL
class_<TdApi, PyTdApi> TdApi(m, "TdApi");
TdApi
.def(init<>())