浏览代码

增加一些注释

tags/v2.9.7
tearshark 4 年前
父节点
当前提交
563abf8aa3
共有 5 个文件被更改,包括 16 次插入8 次删除
  1. 3
    0
      librf/src/event.h
  2. 1
    0
      tutorial/test_async_event.cpp
  3. 1
    1
      tutorial/test_async_resumable.cpp
  4. 1
    1
      vs_proj/librf.cpp
  5. 10
    6
      vs_proj/librf.vcxproj

+ 3
- 0
librf/src/event.h 查看文件

}; };
} }
//提供一种在协程和非协程之间同步的手段。
//典型用法是在非协程的线程,或者异步代码里,调用signal()方法触发信号,
//协程代码里,调用co_await wait()等系列方法等待同步。
struct event_t struct event_t
{ {
typedef std::shared_ptr<detail::event_impl> event_impl_ptr; typedef std::shared_ptr<detail::event_impl> event_impl_ptr;

+ 1
- 0
tutorial/test_async_event.cpp 查看文件

using namespace resumef; using namespace resumef;
//非协程的逻辑线程,或异步代码,可以通过event_t通知到协程,并且不会阻塞协程所在的线程。
std::thread async_set_event(const event_t & e, std::chrono::milliseconds dt) std::thread async_set_event(const event_t & e, std::chrono::milliseconds dt)
{ {
return std::thread([=] return std::thread([=]

+ 1
- 1
tutorial/test_async_resumable.cpp 查看文件

std::cout << idx << ":" << name << " "; std::cout << idx << ":" << name << " ";
std::cout << N << " " << ns << " ns "; std::cout << N << " " << ns << " ns ";
std::cout << (ns / N) << " ns/op" << " "; std::cout << (ns / N) << " ns/op" << " ";
std::cout << (N * 100 * 1000 / ns) << "w/cps" << std::endl;
std::cout << (N * 100ll * 1000ll / ns) << "w/cps" << std::endl;
lock_console.unlock(); lock_console.unlock();
} }

+ 1
- 1
vs_proj/librf.cpp 查看文件

extern void resumable_main_benchmark_asio_server(); extern void resumable_main_benchmark_asio_server();
extern void resumable_main_benchmark_asio_client(intptr_t nNum); extern void resumable_main_benchmark_asio_client(intptr_t nNum);
int main(int argc, const char * argv[])
int main(int argc, const char* argv[])
{ {
resumable_main_modern_cb(); resumable_main_modern_cb();
//resumable_main_benchmark_mem(); //resumable_main_benchmark_mem();

+ 10
- 6
vs_proj/librf.vcxproj 查看文件

<ProjectGuid>{C1D4A6BD-592F-4E48-8178-7C87219BF80E}</ProjectGuid> <ProjectGuid>{C1D4A6BD-592F-4E48-8178-7C87219BF80E}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>librf</RootNamespace> <RootNamespace>librf</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>
<ClCompile Include="..\tutorial\test_async_timer.cpp" /> <ClCompile Include="..\tutorial\test_async_timer.cpp" />
<ClCompile Include="..\tutorial\test_async_when_all.cpp" /> <ClCompile Include="..\tutorial\test_async_when_all.cpp" />
<ClCompile Include="..\tutorial\test_async_yield_return.cpp" /> <ClCompile Include="..\tutorial\test_async_yield_return.cpp" />
<ClCompile Include="librf.cpp" />
<ClCompile Include="librf.cpp">
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Default</BasicRuntimeChecks>
<BufferSecurityCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</BufferSecurityCheck>
<SDLCheck Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</SDLCheck>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\librf\librf.h" /> <ClInclude Include="..\librf\librf.h" />

正在加载...
取消
保存