@@ -965,7 +965,7 @@ TEST_CASE("Exception.ModuleTask.4threads" * doctest::timeout(300)) {
965965}
966966
967967// ----------------------------------------------------------------------------
968- // Exception.AsyncTask
968+ // Exception.Async
969969// ----------------------------------------------------------------------------
970970
971971void async_task (unsigned W) {
@@ -983,35 +983,35 @@ void async_task(unsigned W) {
983983 });
984984 REQUIRE_THROWS_WITH_AS (fu2.get (), " x" , std::runtime_error);
985985
986- // // exception is caught without any action
987- // executor.silent_async([](){
988- // throw std::runtime_error("y");
989- // });
986+ // exception is caught without any action
987+ executor.silent_async ([](){
988+ throw std::runtime_error (" y" );
989+ });
990990
991- // executor.wait_for_all();
991+ executor.wait_for_all ();
992992}
993993
994- TEST_CASE (" Exception.AsyncTask .1thread" * doctest::timeout (300 )) {
994+ TEST_CASE (" Exception.Async .1thread" * doctest::timeout (300 )) {
995995 async_task (1 );
996996}
997997
998- TEST_CASE (" Exception.AsyncTask .2threads" * doctest::timeout (300 )) {
998+ TEST_CASE (" Exception.Async .2threads" * doctest::timeout (300 )) {
999999 async_task (2 );
10001000}
10011001
1002- TEST_CASE (" Exception.AsyncTask .3threads" * doctest::timeout (300 )) {
1002+ TEST_CASE (" Exception.Async .3threads" * doctest::timeout (300 )) {
10031003 async_task (3 );
10041004}
10051005
1006- TEST_CASE (" Exception.AsyncTask .4threads" * doctest::timeout (300 )) {
1006+ TEST_CASE (" Exception.Async .4threads" * doctest::timeout (300 )) {
10071007 async_task (4 );
10081008}
10091009
10101010// ----------------------------------------------------------------------------
10111011// Async Task with Runtime
10121012// ----------------------------------------------------------------------------
10131013
1014- void async_task_with_runtime (unsigned W) {
1014+ void async_with_runtime (unsigned W) {
10151015
10161016 tf::Executor executor (W);
10171017 std::vector<std::future<void >> futures;
@@ -1025,29 +1025,36 @@ void async_task_with_runtime(unsigned W) {
10251025 for (auto & fu : futures) {
10261026 REQUIRE_THROWS_WITH_AS (fu.get (), " x" , std::runtime_error);
10271027 }
1028+
1029+ // silently caught by the task
1030+ executor.silent_async ([](tf::Runtime&){
1031+ throw std::runtime_error (" x" );
1032+ });
1033+
1034+ executor.wait_for_all ();
10281035}
10291036
1030- TEST_CASE (" Exception.AsyncTaskWithRuntime .1thread" * doctest::timeout (300 )) {
1031- async_task_with_runtime (1 );
1037+ TEST_CASE (" Exception.Async.Runtime .1thread" * doctest::timeout (300 )) {
1038+ async_with_runtime (1 );
10321039}
10331040
1034- TEST_CASE (" Exception.AsyncTaskWithRuntime .2threads" * doctest::timeout (300 )) {
1035- async_task_with_runtime (2 );
1041+ TEST_CASE (" Exception.Async.Runtime .2threads" * doctest::timeout (300 )) {
1042+ async_with_runtime (2 );
10361043}
10371044
1038- TEST_CASE (" Exception.AsyncTaskWithRuntime .3threads" * doctest::timeout (300 )) {
1039- async_task_with_runtime (3 );
1045+ TEST_CASE (" Exception.Async.Runtime .3threads" * doctest::timeout (300 )) {
1046+ async_with_runtime (3 );
10401047}
10411048
1042- TEST_CASE (" Exception.AsyncTaskWithRuntime .4threads" * doctest::timeout (300 )) {
1043- async_task_with_runtime (4 );
1049+ TEST_CASE (" Exception.Async.Runtime .4threads" * doctest::timeout (300 )) {
1050+ async_with_runtime (4 );
10441051}
10451052
10461053// ----------------------------------------------------------------------------
10471054// Dependent Async Task with Runtime
10481055// ----------------------------------------------------------------------------
10491056
1050- void dependent_async_task_with_runtime (unsigned W) {
1057+ void dependent_async_with_runtime (unsigned W) {
10511058
10521059 tf::Executor executor (W);
10531060 std::vector<std::future<void >> futures;
@@ -1061,22 +1068,29 @@ void dependent_async_task_with_runtime(unsigned W) {
10611068 for (auto & fu : futures) {
10621069 REQUIRE_THROWS_WITH_AS (fu.get (), " x" , std::runtime_error);
10631070 }
1071+
1072+ // silently caught by the task
1073+ executor.silent_dependent_async ([](tf::Runtime&){
1074+ throw std::runtime_error (" x" );
1075+ });
1076+
1077+ executor.wait_for_all ();
10641078}
10651079
1066- TEST_CASE (" Exception.DependentAsyncTaskWithRuntime .1thread" * doctest::timeout (300 )) {
1067- dependent_async_task_with_runtime (1 );
1080+ TEST_CASE (" Exception.DependentAsync.Runtime .1thread" * doctest::timeout (300 )) {
1081+ dependent_async_with_runtime (1 );
10681082}
10691083
1070- TEST_CASE (" Exception.DependentAsyncTaskWithRuntime .2threads" * doctest::timeout (300 )) {
1071- dependent_async_task_with_runtime (2 );
1084+ TEST_CASE (" Exception.DependentAsync.Runtime .2threads" * doctest::timeout (300 )) {
1085+ dependent_async_with_runtime (2 );
10721086}
10731087
1074- TEST_CASE (" Exception.DependentAsyncTaskWithRuntime .3threads" * doctest::timeout (300 )) {
1075- dependent_async_task_with_runtime (3 );
1088+ TEST_CASE (" Exception.DependentAsync.Runtime .3threads" * doctest::timeout (300 )) {
1089+ dependent_async_with_runtime (3 );
10761090}
10771091
1078- TEST_CASE (" Exception.DependentAsyncTaskWithRuntime .4threads" * doctest::timeout (300 )) {
1079- dependent_async_task_with_runtime (4 );
1092+ TEST_CASE (" Exception.DependentAsync.Runtime .4threads" * doctest::timeout (300 )) {
1093+ dependent_async_with_runtime (4 );
10801094}
10811095
10821096/*
@@ -1137,15 +1151,15 @@ void runtime_async_task(unsigned W) {
11371151 REQUIRE(flag == 0);
11381152}
11391153
1140- TEST_CASE("Exception.RuntimeAsyncTask .2threads" * doctest::timeout(300)) {
1154+ TEST_CASE("Exception.RuntimeAsync .2threads" * doctest::timeout(300)) {
11411155 runtime_async_task(2);
11421156}
11431157
1144- TEST_CASE("Exception.RuntimeAsyncTask .3threads" * doctest::timeout(300)) {
1158+ TEST_CASE("Exception.RuntimeAsync .3threads" * doctest::timeout(300)) {
11451159 runtime_async_task(3);
11461160}
11471161
1148- TEST_CASE("Exception.RuntimeAsyncTask .4threads" * doctest::timeout(300)) {
1162+ TEST_CASE("Exception.RuntimeAsync .4threads" * doctest::timeout(300)) {
11491163 runtime_async_task(4);
11501164}
11511165*/
0 commit comments