diff --git a/librf/src/future.h b/librf/src/future.h index 0f03a78..ee1f7d5 100644 --- a/librf/src/future.h +++ b/librf/src/future.h @@ -240,6 +240,12 @@ namespace resumef { return _state->cancellation_requested(); } +/* + void unhandled_exception() + { + std::terminate(); + } +*/ //return_value/return_void 只能由派生类去实现 diff --git a/librf/src/rf_task.h b/librf/src/rf_task.h index b60ce3b..8b638e1 100644 --- a/librf/src/rf_task.h +++ b/librf/src/rf_task.h @@ -149,9 +149,9 @@ namespace resumef //这个'函数对象'被调用后,返回generator<_Ty>/future_t<_Ty>类型 //然后'函数对象'作为异步执行的上下文状态保存起来 template - struct ctx_task_t : public task_t::type> + struct ctx_task_t : public task_t()())>::type> { - typedef task_t::type> base_type; + typedef task_t()())>::type> base_type; using base_type::_future; typedef _Ctx context_type; diff --git a/tutorial/test_async_dynamic_go.cpp b/tutorial/test_async_dynamic_go.cpp index 8973110..2237f61 100644 --- a/tutorial/test_async_dynamic_go.cpp +++ b/tutorial/test_async_dynamic_go.cpp @@ -14,11 +14,11 @@ std::array, M>, 3> dynamic_cells; void test_dynamic_go() { - auto co_star = [](int j) + auto co_star = [](int j) -> resumef::future_t { for (int i = 0; i < M; ++i) { - go[=]() + go[=]() -> std::experimental::generator { for (int k = 0; k < M; ++k) { diff --git a/tutorial/test_async_resumable.cpp b/tutorial/test_async_resumable.cpp index 0df692d..2f1a995 100644 --- a/tutorial/test_async_resumable.cpp +++ b/tutorial/test_async_resumable.cpp @@ -26,7 +26,7 @@ void dump(size_t idx, std::string name, T start, T end, intptr_t count) static const intptr_t N = 3000000; //static const int N = 10; -auto yield_switch(intptr_t coro) +auto yield_switch(intptr_t coro) -> std::experimental::generator { for (intptr_t i = 0; i < N / coro; ++i) co_yield i; @@ -42,7 +42,7 @@ void resumable_switch(intptr_t coro, size_t idx) for (intptr_t i = 0; i < coro; ++i) { //go yield_switch(coro); - go [=] + go [=] ()->std::experimental::generator { for (intptr_t i = 0; i < N / coro; ++i) co_yield i; diff --git a/tutorial/test_async_yield_return.cpp b/tutorial/test_async_yield_return.cpp index ba80993..ca0c3b4 100644 --- a/tutorial/test_async_yield_return.cpp +++ b/tutorial/test_async_yield_return.cpp @@ -10,7 +10,7 @@ using namespace resumef; //std::experimental::generator -auto test_yield_int() +auto test_yield_int() -> std::experimental::generator { std::cout << "1 will yield return" << std::endl; co_yield 1; @@ -43,7 +43,7 @@ auto test_yield_void() } */ -auto test_yield_void() +auto test_yield_void() -> std::experimental::generator { std::cout << "block 1 will yield return" << std::endl; co_yield_void; diff --git a/vs_proj/librf.cpp b/vs_proj/librf.cpp index 4dd42c7..b9fe2cf 100644 --- a/vs_proj/librf.cpp +++ b/vs_proj/librf.cpp @@ -33,7 +33,7 @@ int main(int argc, const char* argv[]) else resumable_main_benchmark_asio_server(); */ - return 0; + //return 0; resumable_main_when_all(); resumable_main_multi_thread(); diff --git a/vs_proj/librf.vcxproj b/vs_proj/librf.vcxproj index df42f62..d0a2884 100644 --- a/vs_proj/librf.vcxproj +++ b/vs_proj/librf.vcxproj @@ -23,7 +23,7 @@ {C1D4A6BD-592F-4E48-8178-7C87219BF80E} Win32Proj librf - 10.0 + 10.0.18362.0 @@ -42,7 +42,7 @@ Application true - v142 + v140 NotSet @@ -88,7 +88,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;ASIO_STANDALONE;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;ASIO_STANDALONE;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;ASIO_DISABLE_CONCEPTS=1;%(PreprocessorDefinitions) true ..\librf;..\..\asio\asio\include;..\..\asio-1.10.6\include;%(AdditionalIncludeDirectories) /await @@ -104,7 +104,7 @@ Level3 Disabled - _DEBUG;_CONSOLE;ASIO_STANDALONE;RESUMEF_DEBUG_COUNTER=0;RESUMEF_ENABLE_MULT_SCHEDULER=1;RESUMEF_USE_BOOST_ANY=0;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;%(PreprocessorDefinitions) + _DEBUG;_CONSOLE;ASIO_STANDALONE;RESUMEF_DEBUG_COUNTER=0;RESUMEF_ENABLE_MULT_SCHEDULER=1;RESUMEF_USE_BOOST_ANY=0;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;ASIO_DISABLE_CONCEPTS=1;%(PreprocessorDefinitions) true ..\librf;..\..\asio\asio\include;..\..\asio-1.10.6\include;%(AdditionalIncludeDirectories) /await @@ -126,7 +126,7 @@ Full true true - WIN32;NDEBUG;_CONSOLE;ASIO_STANDALONE;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;ASIO_STANDALONE;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;ASIO_DISABLE_CONCEPTS=1;%(PreprocessorDefinitions) ..\librf;..\..\asio\asio\include;..\..\asio-1.10.6\include;%(AdditionalIncludeDirectories) @@ -153,7 +153,7 @@ MaxSpeed true true - NDEBUG;_CONSOLE;ASIO_STANDALONE;RESUMEF_ENABLE_MULT_SCHEDULER=1;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;%(PreprocessorDefinitions) + NDEBUG;_CONSOLE;ASIO_STANDALONE;RESUMEF_ENABLE_MULT_SCHEDULER=1;_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING=1;ASIO_DISABLE_CONCEPTS=1;%(PreprocessorDefinitions) ..\librf;..\..\asio\asio\include;..\..\asio-1.10.6\include;%(AdditionalIncludeDirectories) /await Sync