Merge pull request #1385 from nanoric/v2.0-DEV
api.ctp: terminate task queue when exit() is called
This commit is contained in:
commit
c81bd01d8f
@ -8,3 +8,6 @@ pandas
|
|||||||
matplotlib
|
matplotlib
|
||||||
seaborn
|
seaborn
|
||||||
jupyter
|
jupyter
|
||||||
|
#ta-lib
|
||||||
|
#https://download.lfd.uci.edu/pythonlibs/r5uhg2lo/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl
|
||||||
|
|
||||||
|
@ -570,7 +570,8 @@ int MdApi::join()
|
|||||||
int MdApi::exit()
|
int MdApi::exit()
|
||||||
{
|
{
|
||||||
this->active = false;
|
this->active = false;
|
||||||
//this->task_thread.join();
|
this->task_queue.terminate();
|
||||||
|
this->task_thread.join();
|
||||||
|
|
||||||
this->api->RegisterSpi(NULL);
|
this->api->RegisterSpi(NULL);
|
||||||
this->api->Release();
|
this->api->Release();
|
||||||
@ -808,8 +809,6 @@ public:
|
|||||||
|
|
||||||
PYBIND11_MODULE(vnctpmd, m)
|
PYBIND11_MODULE(vnctpmd, m)
|
||||||
{
|
{
|
||||||
PyEval_InitThreads(); //导入时运行,保证先创建GIL
|
|
||||||
|
|
||||||
class_<MdApi, PyMdApi> mdapi(m, "MdApi");
|
class_<MdApi, PyMdApi> mdapi(m, "MdApi");
|
||||||
mdapi
|
mdapi
|
||||||
.def(init<>())
|
.def(init<>())
|
||||||
|
@ -75,12 +75,14 @@
|
|||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
@ -88,6 +90,7 @@
|
|||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<ReferencePath>C:\GitHub\vnpy\vnpy\api\ctp\ctpapi;$(ReferencePath)</ReferencePath>
|
<ReferencePath>C:\GitHub\vnpy\vnpy\api\ctp\ctpapi;$(ReferencePath)</ReferencePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
@ -95,6 +98,7 @@
|
|||||||
<ReferencePath>$(ReferencePath)</ReferencePath>
|
<ReferencePath>$(ReferencePath)</ReferencePath>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -137,6 +141,7 @@
|
|||||||
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;VNCTPMD_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;VNCTPMD_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -158,6 +163,7 @@
|
|||||||
<AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
</AdditionalIncludeDirectories>
|
</AdditionalIncludeDirectories>
|
||||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
@ -7921,7 +7921,8 @@ int TdApi::join()
|
|||||||
int TdApi::exit()
|
int TdApi::exit()
|
||||||
{
|
{
|
||||||
this->active = false;
|
this->active = false;
|
||||||
//this->task_thread.join();
|
this->task_queue.terminate();
|
||||||
|
this->task_thread.join();
|
||||||
|
|
||||||
this->api->RegisterSpi(NULL);
|
this->api->RegisterSpi(NULL);
|
||||||
this->api->Release();
|
this->api->Release();
|
||||||
@ -10631,8 +10632,6 @@ public:
|
|||||||
|
|
||||||
PYBIND11_MODULE(vnctptd, m)
|
PYBIND11_MODULE(vnctptd, m)
|
||||||
{
|
{
|
||||||
PyEval_InitThreads(); //导入时运行,保证先创建GIL
|
|
||||||
|
|
||||||
class_<TdApi, PyTdApi> TdApi(m, "TdApi");
|
class_<TdApi, PyTdApi> TdApi(m, "TdApi");
|
||||||
TdApi
|
TdApi
|
||||||
.def(init<>())
|
.def(init<>())
|
||||||
|
@ -75,24 +75,28 @@
|
|||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<TargetExt>.pyd</TargetExt>
|
<TargetExt>.pyd</TargetExt>
|
||||||
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
<IncludePath>C:\Python37\include;$(SolutionDir);$(SolutionDir)..\include;$(SolutionDir)..\include\ctp;$(IncludePath)</IncludePath>
|
||||||
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
<LibraryPath>C:\Python37\libs;$(SolutionDir)..\libs;$(LibraryPath)</LibraryPath>
|
||||||
|
<OutDir>$(SolutionDir)..\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -135,6 +139,7 @@
|
|||||||
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;VNCTPTD_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;VNCTPTD_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@ -156,6 +161,7 @@
|
|||||||
<AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
</AdditionalIncludeDirectories>
|
</AdditionalIncludeDirectories>
|
||||||
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>stdafx.h</ForcedIncludeFiles>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user