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

@@ -232,13 +232,13 @@ namespace detail
{
if constexpr (USE_LINK_QUEUE)
{
return reinterpret_cast<state_read_t*>(_read_awakes.try_pop());
return _read_awakes.try_pop();
}
else
{
if (!_read_awakes.empty())
{
state_write_t* state = _read_awakes.front();
state_read_t* state = _read_awakes.front();
_read_awakes.pop_front();
return state;
}
@@ -251,7 +251,7 @@ namespace detail
{
if constexpr (USE_LINK_QUEUE)
{
return reinterpret_cast<state_write_t*>(_write_awakes.try_pop());
return _write_awakes.try_pop();
}
else
{

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

@@ -155,7 +155,7 @@ RESUMEF_NS
return false;

_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());


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

@@ -20,9 +20,12 @@ RESUMEF_NS
template<typename T>
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_resume() };
requires traits::is_valid_await_suspend_return_v<
decltype(v.await_suspend(std::declval<std::experimental::coroutine_handle<promise_t<>>>()))
>;
};
template<typename T>

+ 3
- 6
vs_proj/librf.cpp View File

@@ -43,12 +43,9 @@ int main(int argc, const char* argv[])
//test_ring_queue<resumef::ring_queue_spinlock<int, false, uint32_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)
// resumable_main_benchmark_asio_client(atoi(argv[1]));

+ 2
- 2
vs_proj/librf.vcxproj View File

@@ -40,13 +40,13 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>ClangCL</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>

Loading…
Cancel
Save