@@ -17,7 +17,7 @@ namespace resumef | |||
_lock(); | |||
} | |||
counted_ptr(counted_ptr&& cp) | |||
counted_ptr(counted_ptr&& cp) noexcept | |||
{ | |||
std::swap(_p, cp._p); | |||
} | |||
@@ -32,7 +32,7 @@ namespace resumef | |||
return *this; | |||
} | |||
counted_ptr& operator=(counted_ptr&& cp) | |||
counted_ptr& operator=(counted_ptr&& cp) noexcept | |||
{ | |||
if (&cp != this) | |||
std::swap(_p, cp._p); |
@@ -165,14 +165,14 @@ namespace resumef | |||
_state->this_promise(this); | |||
#endif | |||
} | |||
promise_impl_t(promise_impl_t&& _Right) | |||
promise_impl_t(promise_impl_t&& _Right) noexcept | |||
: _state(std::move(_Right._state)) | |||
{ | |||
#if RESUMEF_ENABLE_MULT_SCHEDULER | |||
_state->this_promise(this); | |||
#endif | |||
} | |||
promise_impl_t & operator = (promise_impl_t&& _Right) | |||
promise_impl_t & operator = (promise_impl_t&& _Right) noexcept | |||
{ | |||
if (this != _Right) | |||
{ |
@@ -101,7 +101,7 @@ namespace experimental { | |||
_Ty const &operator*() const | |||
{ | |||
return *_Coro.promise()._CurrentValue; | |||
return *this->_Coro.promise()._CurrentValue; | |||
} | |||
_Ty const *operator->() const | |||
@@ -166,7 +166,7 @@ namespace experimental { | |||
return _Al.allocate(_Size); | |||
} | |||
void operator delete(void *_Ptr, size_t _Size)_NOEXCEPT | |||
void operator delete(void *_Ptr, size_t _Size) | |||
{ | |||
_Alloc_of_char_type _Al; | |||
return _Al.deallocate(static_cast<char *>(_Ptr), _Size); |
@@ -104,7 +104,7 @@ namespace resumef | |||
#if !defined(_DISABLE_RESUMEF_GO_MACRO) | |||
#define go (*::resumef::this_scheduler()) + | |||
#define GO (*::resumef::this_scheduler()) + [=]()->resumef::future_vt | |||
#define GO (*::resumef::this_scheduler()) + [=]()mutable->resumef::future_vt | |||
#endif | |||
//-------------------------------------------------------------------------------------------------- |
@@ -36,4 +36,11 @@ namespace resumef | |||
{ | |||
return std::move(sleep_until_(std::chrono::time_point_cast<std::chrono::system_clock::duration>(tp_), *this_scheduler())); | |||
} | |||
template <class Rep, class Period> | |||
auto operator co_await(std::chrono::duration<Rep, Period> dt_) | |||
{ | |||
return sleep_for(dt_); | |||
} | |||
} |
@@ -35,7 +35,7 @@ namespace resumef | |||
task_list(const task_list& _Right) = delete; | |||
task_list& operator=(const task_list& _Right) = delete; | |||
task_list(task_list&& _Right) | |||
task_list(task_list&& _Right) noexcept | |||
{ | |||
_M_header = _Right._M_header; | |||
_Right._M_header = nullptr; | |||
@@ -43,7 +43,7 @@ namespace resumef | |||
_Right._M_last = nullptr; | |||
} | |||
task_list& operator=(task_list&& _Right) | |||
task_list& operator=(task_list&& _Right) noexcept | |||
{ // assign by moving _Right | |||
if (this != std::addressof(_Right)) | |||
{ // different, assign it |
@@ -37,7 +37,7 @@ namespace resumef | |||
template<class callee_t, class dummy_t = std::enable_if<!std::is_same<std::remove_cv_t<callee_t>, event_awaker_ptr>::value>> | |||
auto wait(callee_t && awaker, dummy_t * dummy_ = nullptr) | |||
{ | |||
return wait_(std::make_shared<event_awaker>(std::forward<callee_t>(awaker))); | |||
return wait_(std::make_shared<when_awaker>(std::forward<callee_t>(awaker))); | |||
} | |||
when_impl(const when_impl &) = delete; |
@@ -16,7 +16,9 @@ future_vt test_sleep_use_timer() | |||
resumef::sleep_for(100ms); //incorrect!!! | |||
co_await resumef::sleep_for(100ms); | |||
std::cout << "timer after 100ms." << std::endl; | |||
std::cout << "sleep_for 100ms." << std::endl; | |||
co_await 100ms; | |||
std::cout << "co_await 100ms." << std::endl; | |||
try | |||
{ |
@@ -22,7 +22,8 @@ extern void resumable_main_benchmark_mem(); | |||
int main(int argc, const char * argv[]) | |||
{ | |||
//resumable_main_sleep(); | |||
resumable_main_sleep(); | |||
return 0; | |||
//resumable_main_resumable(); | |||
resumable_main_when_all(); |
@@ -105,12 +105,13 @@ | |||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;RESUMEF_DEBUG_COUNTER=0;RESUMEF_ENABLE_MULT_SCHEDULER=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
<SDLCheck>true</SDLCheck> | |||
<AdditionalIncludeDirectories>..\librf;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |||
<AdditionalOptions>/await</AdditionalOptions> | |||
<AdditionalOptions>/await /permissive- </AdditionalOptions> | |||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | |||
<LanguageStandard>stdcpp17</LanguageStandard> | |||
<LanguageStandard>stdcpplatest</LanguageStandard> | |||
<MinimalRebuild /> | |||
<CLanguageStandard>c11</CLanguageStandard> | |||
<CppLanguageStandard>c++1y</CppLanguageStandard> | |||
<DisableLanguageExtensions>true</DisableLanguageExtensions> | |||
</ClCompile> | |||
<Link> | |||
<SubSystem>Console</SubSystem> | |||
@@ -156,6 +157,7 @@ | |||
<LanguageStandard>stdcpplatest</LanguageStandard> | |||
<BufferSecurityCheck>false</BufferSecurityCheck> | |||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | |||
<DisableLanguageExtensions>true</DisableLanguageExtensions> | |||
</ClCompile> | |||
<Link> | |||
<SubSystem>Console</SubSystem> |