Browse Source

完善concept定义

tags/v2.9.7
tearshark 4 years ago
parent
commit
d13ae66d87
5 changed files with 13 additions and 13 deletions
  1. 3
    3
      librf/src/channel_v2.inl
  2. 1
    1
      librf/src/mutex_v2.inl
  3. 4
    1
      librf/src/type_concept.inl
  4. 3
    6
      vs_proj/librf.cpp
  5. 2
    2
      vs_proj/librf.vcxproj

+ 3
- 3
librf/src/channel_v2.inl View File

{ {
if constexpr (USE_LINK_QUEUE) if constexpr (USE_LINK_QUEUE)
{ {
return reinterpret_cast<state_read_t*>(_read_awakes.try_pop());
return _read_awakes.try_pop();
} }
else else
{ {
if (!_read_awakes.empty()) if (!_read_awakes.empty())
{ {
state_write_t* state = _read_awakes.front();
state_read_t* state = _read_awakes.front();
_read_awakes.pop_front(); _read_awakes.pop_front();
return state; return state;
} }
{ {
if constexpr (USE_LINK_QUEUE) if constexpr (USE_LINK_QUEUE)
{ {
return reinterpret_cast<state_write_t*>(_write_awakes.try_pop());
return _write_awakes.try_pop();
} }
else else
{ {

+ 1
- 1
librf/src/mutex_v2.inl View File

return false; return false;


_state = new detail::state_mutex_t(); _state = new detail::state_mutex_t();
(void)_state->on_await_suspend(handler, parent->get_scheduler(), _root);
_state->on_await_suspend(handler, parent->get_scheduler(), _root);


_mutex->add_wait_list_lockless(_state.get()); _mutex->add_wait_list_lockless(_state.get());



+ 4
- 1
librf/src/type_concept.inl View File

template<typename T> template<typename T>
concept _AwaitorT = requires(T&& v) concept _AwaitorT = requires(T&& v)
{ {
{ v.await_ready() } -> bool;
{ v.await_ready() } ->bool;
{ v.await_suspend(std::declval<std::experimental::coroutine_handle<promise_t<>>>()) }; { v.await_suspend(std::declval<std::experimental::coroutine_handle<promise_t<>>>()) };
{ v.await_resume() }; { v.await_resume() };
requires traits::is_valid_await_suspend_return_v<
decltype(v.await_suspend(std::declval<std::experimental::coroutine_handle<promise_t<>>>()))
>;
}; };
template<typename T> template<typename T>

+ 3
- 6
vs_proj/librf.cpp View File

//test_ring_queue<resumef::ring_queue_spinlock<int, false, uint32_t>>(); //test_ring_queue<resumef::ring_queue_spinlock<int, false, uint32_t>>();
//test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>(); //test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>();
//resumable_main_event_v2();
//resumable_main_event();
//resumable_main_event_timeout();
//resumable_main_sleep();
//resumable_main_resumable();
//return 0;
resumable_main_channel_mult_thread();
resumable_main_channel();
return 0;
//if (argc > 1) //if (argc > 1)
// resumable_main_benchmark_asio_client(atoi(argv[1])); // resumable_main_benchmark_asio_client(atoi(argv[1]));

+ 2
- 2
vs_proj/librf.vcxproj View File

</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
</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>ClangCL</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>

Loading…
Cancel
Save