Browse Source

整理代码

tags/2.9.10
tearshark 4 years ago
parent
commit
e43182d58b

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

@@ -17,11 +17,11 @@ namespace resumef
using lock_type = typename state_type::lock_type;
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;

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

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

@@ -23,13 +23,13 @@ namespace resumef
future_t(counted_ptr<state_type> _st) noexcept
:_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;
bool await_ready() noexcept
bool await_ready() const noexcept
{
return _state->future_await_ready();
}
@@ -40,7 +40,7 @@ namespace resumef
_state->future_await_suspend(handler);
}
value_type await_resume()
value_type await_resume() const
{
return _state->future_await_resume();
}

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

@@ -17,7 +17,7 @@ namespace resumef
using promise_type = promise_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& operator = (promise_impl_t&& _Right) noexcept = default;
promise_impl_t(const promise_impl_t&) = delete;

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

@@ -2,7 +2,7 @@
namespace resumef
{
task_t::task_t()
task_t::task_t() noexcept
: _stop(nostopstate)
{
}

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

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

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

@@ -58,7 +58,7 @@ namespace resumef
}
}
local_scheduler_t::local_scheduler_t(scheduler_t& sch)
local_scheduler_t::local_scheduler_t(scheduler_t& sch) noexcept
{
if (th_scheduler_ptr == nullptr)
{

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

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

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

@@ -20,7 +20,7 @@ namespace resumef
switch_scheduler_awaitor& operator = (const switch_scheduler_awaitor&) = default;
switch_scheduler_awaitor& operator = (switch_scheduler_awaitor&&) = default;

bool await_ready() noexcept
bool await_ready() const noexcept
{
return false;
}
@@ -41,7 +41,7 @@ namespace resumef
return false;
}

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


+ 1
- 1
vs_proj/librf.vcxproj View File

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

Loading…
Cancel
Save