Browse Source

完成新版本下的channel

tags/v2.9.7
tearshark 4 years ago
parent
commit
ff96b20308
3 changed files with 7 additions and 17 deletions
  1. 2
    2
      librf/src/channel.h
  2. 3
    3
      vs_proj/librf.cpp
  3. 2
    12
      vs_proj/librf.vcxproj

+ 2
- 2
librf/src/channel.h View File

template<class _Ty2> template<class _Ty2>
future_t<bool> write(_Ty2&& val) const future_t<bool> write(_Ty2&& val) const
{ {
promise_t<bool> awaitable;
awaitable_t<bool> awaitable;
auto awaker = std::make_shared<channel_write_awaker>( auto awaker = std::make_shared<channel_write_awaker>(
[st = awaitable._state](channel_impl_type * chan) -> bool [st = awaitable._state](channel_impl_type * chan) -> bool
future_t<_Ty> read() const future_t<_Ty> read() const
{ {
promise_t<_Ty> awaitable;
awaitable_t<_Ty> awaitable;
auto awaker = std::make_shared<channel_read_awaker>( auto awaker = std::make_shared<channel_read_awaker>(
[st = awaitable._state](channel_impl_type *, _Ty * val, error_code fe) -> bool [st = awaitable._state](channel_impl_type *, _Ty * val, error_code fe) -> bool

+ 3
- 3
vs_proj/librf.cpp View File

//resumable_main_timer(); //resumable_main_timer();
//resumable_main_benchmark_mem(); //resumable_main_benchmark_mem();
//resumable_main_mutex(); //resumable_main_mutex();
resumable_main_event();
//resumable_main_event();
//resumable_main_event_timeout();
resumable_main_channel();
/* /*
resumable_main_benchmark_mem(); resumable_main_benchmark_mem();
resumable_main_when_all(); resumable_main_when_all();
resumable_main_sleep(); resumable_main_sleep();
resumable_main_event_timeout();
resumable_main_channel();
*/ */
return 0; return 0;

+ 2
- 12
vs_proj/librf.vcxproj View File

<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\tutorial\test_async_cb.cpp" /> <ClCompile Include="..\tutorial\test_async_cb.cpp" />
<ClCompile Include="..\tutorial\test_async_channel.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\tutorial\test_async_channel.cpp" />
<ClCompile Include="..\tutorial\test_async_channel_mult_thread.cpp"> <ClCompile Include="..\tutorial\test_async_channel_mult_thread.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\tutorial\test_async_dynamic_go.cpp" /> <ClCompile Include="..\tutorial\test_async_dynamic_go.cpp" />
<ClCompile Include="..\tutorial\test_async_event.cpp" /> <ClCompile Include="..\tutorial\test_async_event.cpp" />
<ClCompile Include="..\tutorial\test_async_event_timeout.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\tutorial\test_async_event_timeout.cpp" />
<ClCompile Include="..\tutorial\test_async_exception.cpp" /> <ClCompile Include="..\tutorial\test_async_exception.cpp" />
<ClCompile Include="..\tutorial\test_async_modern_cb.cpp" /> <ClCompile Include="..\tutorial\test_async_modern_cb.cpp" />
<ClCompile Include="..\tutorial\test_async_multi_thread.cpp" /> <ClCompile Include="..\tutorial\test_async_multi_thread.cpp" />

Loading…
Cancel
Save