diff --git a/uppsrc/Core/CoWork.h b/uppsrc/Core/CoWork.h index 903db784e..439876fd3 100644 --- a/uppsrc/Core/CoWork.h +++ b/uppsrc/Core/CoWork.h @@ -125,6 +125,12 @@ void CoDo(Function&& fn) co * fn; } +inline +void CoDo_ST(Function&& fn) +{ + fn(); +} + template void CoFor(int n, Fn iterator) { diff --git a/uppsrc/Core/src.tpp/CoWork_en-us.tpp b/uppsrc/Core/src.tpp/CoWork_en-us.tpp index 0f9731693..915c37cf3 100644 --- a/uppsrc/Core/src.tpp/CoWork_en-us.tpp +++ b/uppsrc/Core/src.tpp/CoWork_en-us.tpp @@ -191,10 +191,9 @@ nt]_[*@3 n])&] [s2;%% This simple helper class just removes `"noexcept(false)`" from CoWork destructor, removing exception throws from the destructor and allowing it to be used as member variable. Obviously, if -exception handling is required, you need to use Finish (not depend -on destructor to call it).&] -[s0; &] -[s0; &] +exception handling is required, you need to use Finish (not to +depend on destructor to call it).&] +[s3; &] [ {{10000@(113.42.0) [s0;%% [*@7;4 Loop parallelisation functions]]}}&] [s3; &] [s5;:Upp`:`:CoDo`(Upp`:`:Function``&`&`): [@(0.0.255) void]_[* CoDo]([_^Upp`:`:Function^ F @@ -203,6 +202,13 @@ unction]<[@(0.0.255) void]_()>`&`&_[*@3 fn])&] effective way to parallelise iteration.&] [s3;%% &] [s4; &] +[s5;:Upp`:`:CoDo`_ST`(Upp`:`:Function``&`&`): [@(0.0.255) void]_[* CoDo`_ST]([_^Upp`:`:Function^ F +unction]<[@(0.0.255) void]_()>`&`&_[*@3 fn])&] +[s2;%% This function simply calls [%-*@3 fn]. It is diagnostics tool +`- it allows to change CoDo parallel iteration into serial one +by adding `"`_ST`" text.&] +[s3;%% &] +[s4; &] [s5;:Upp`:`:CoFor`(int`,Fn`): [@(0.0.255) template]_<[@(0.0.255) typename]_[*@4 Fn]>_[@(0.0.255) v oid]_[* CoFor]([@(0.0.255) int]_[*@3 n], [*@4 Fn]_[*@3 iterator])&] [s2;%% Based on CoDo, runs in parallel [%-*@3 iterator] for values