Browse Source

整理代码

tags/2.9.10
tearshark 4 years ago
parent
commit
e43182d58b

+ 5
- 5
librf/src/awaitable.h View File

using lock_type = typename state_type::lock_type; using lock_type = typename state_type::lock_type;
using _Alloc_char = typename state_type::_Alloc_char; using _Alloc_char = typename state_type::_Alloc_char;


awaitable_impl_t() {}
awaitable_impl_t(const awaitable_impl_t&) = default;
awaitable_impl_t(awaitable_impl_t&&) = default;
awaitable_impl_t() noexcept = default;
awaitable_impl_t(const awaitable_impl_t&) noexcept = default;
awaitable_impl_t(awaitable_impl_t&&) noexcept = default;


awaitable_impl_t& operator = (const awaitable_impl_t&) = default;
awaitable_impl_t& operator = (const awaitable_impl_t&) noexcept = default;
awaitable_impl_t& operator = (awaitable_impl_t&&) = default; awaitable_impl_t& operator = (awaitable_impl_t&&) = default;


/** /**
/** /**
* @brief 获得与之关联的future_t<>对象,作为可等待函数(awaitable function)的返回值。 * @brief 获得与之关联的future_t<>对象,作为可等待函数(awaitable function)的返回值。
*/ */
future_type get_future() noexcept
future_type get_future() const noexcept
{ {
return future_type{ this->_state }; return future_type{ this->_state };
} }

+ 5
- 5
librf/src/future.h View File

future_t(counted_ptr<state_type> _st) noexcept future_t(counted_ptr<state_type> _st) noexcept
:_state(std::move(_st)) {} :_state(std::move(_st)) {}
future_t(const future_t&) = default;
future_t(future_t&&) = default;
future_t(const future_t&) noexcept = default;
future_t(future_t&&) noexcept = default;
future_t& operator = (const future_t&) = default;
future_t& operator = (const future_t&) noexcept = default;
future_t& operator = (future_t&&) = default; future_t& operator = (future_t&&) = default;
bool await_ready() noexcept
bool await_ready() const noexcept
{ {
return _state->future_await_ready(); return _state->future_await_ready();
} }
_state->future_await_suspend(handler); _state->future_await_suspend(handler);
} }
value_type await_resume()
value_type await_resume() const
{ {
return _state->future_await_resume(); return _state->future_await_resume();
} }

+ 1
- 1
librf/src/promise.h View File

using promise_type = promise_t<value_type>; using promise_type = promise_t<value_type>;
using future_type = future_t<value_type>; using future_type = future_t<value_type>;


promise_impl_t() noexcept {}
promise_impl_t() noexcept = default;
promise_impl_t(promise_impl_t&& _Right) noexcept = default; promise_impl_t(promise_impl_t&& _Right) noexcept = default;
promise_impl_t& operator = (promise_impl_t&& _Right) noexcept = default; promise_impl_t& operator = (promise_impl_t&& _Right) noexcept = default;
promise_impl_t(const promise_impl_t&) = delete; promise_impl_t(const promise_impl_t&) = delete;

+ 1
- 1
librf/src/rf_task.cpp View File

namespace resumef namespace resumef
{ {
task_t::task_t()
task_t::task_t() noexcept
: _stop(nostopstate) : _stop(nostopstate)
{ {
} }

+ 4
- 4
librf/src/rf_task.h View File

*/ */
struct task_t struct task_t
{ {
task_t();
task_t() noexcept;
virtual ~task_t(); virtual ~task_t();
/** /**
* @brief 要求停止协程。 * @brief 要求停止协程。
* @return bool 返回操作成功与否。 * @return bool 返回操作成功与否。
*/ */
bool request_stop_if_possible()
bool request_stop_if_possible() const
{ {
if (_stop.stop_possible()) if (_stop.stop_possible())
return _stop.request_stop(); return _stop.request_stop();
using value_type = typename future_type::value_type; using value_type = typename future_type::value_type;
using state_type = state_t<value_type>; using state_type = state_t<value_type>;
task_impl_t() = default;
task_impl_t() noexcept = default;
task_impl_t(future_type& f) task_impl_t(future_type& f)
{ {
initialize(f); initialize(f);
using future_type = generator_t<value_type>; using future_type = generator_t<value_type>;
using state_type = state_generator_t; using state_type = state_generator_t;
task_impl_t() = default;
task_impl_t() noexcept = default;
task_impl_t(future_type& f) task_impl_t(future_type& f)
{ {
initialize(f); initialize(f);

+ 1
- 1
librf/src/scheduler.cpp View File

} }
} }
local_scheduler_t::local_scheduler_t(scheduler_t& sch)
local_scheduler_t::local_scheduler_t(scheduler_t& sch) noexcept
{ {
if (th_scheduler_ptr == nullptr) if (th_scheduler_ptr == nullptr)
{ {

+ 1
- 1
librf/src/scheduler.h View File

/** /**
* @brief 将指定的调度器绑定到当前线程上。 * @brief 将指定的调度器绑定到当前线程上。
*/ */
local_scheduler_t(scheduler_t & sch);
local_scheduler_t(scheduler_t & sch) noexcept;
/** /**
* @brief 如果当前线程绑定的调度器由local_scheduler_t所创建,则会销毁调度器,并解绑线程。 * @brief 如果当前线程绑定的调度器由local_scheduler_t所创建,则会销毁调度器,并解绑线程。

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

switch_scheduler_awaitor& operator = (const switch_scheduler_awaitor&) = default; switch_scheduler_awaitor& operator = (const switch_scheduler_awaitor&) = default;
switch_scheduler_awaitor& operator = (switch_scheduler_awaitor&&) = default; switch_scheduler_awaitor& operator = (switch_scheduler_awaitor&&) = default;


bool await_ready() noexcept
bool await_ready() const noexcept
{ {
return false; return false;
} }
return false; return false;
} }


void await_resume() noexcept
void await_resume() const noexcept
{ {
} }



+ 1
- 1
vs_proj/librf.vcxproj View File

<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>v142</PlatformToolset>
<PlatformToolset>ClangCL</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
</PropertyGroup> </PropertyGroup>

Loading…
Cancel
Save