Core: CoDo_ST - diagnostic ST variant of CoDo

git-svn-id: svn://ultimatepp.org/upp/trunk@14262 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-04-06 20:20:33 +00:00
parent a0b12c1647
commit 3146d14431
2 changed files with 16 additions and 4 deletions

View file

@ -125,6 +125,12 @@ void CoDo(Function<void ()>&& fn)
co * fn;
}
inline
void CoDo_ST(Function<void ()>&& fn)
{
fn();
}
template <typename Fn>
void CoFor(int n, Fn iterator)
{

View file

@ -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`<void`(`)`>`&`&`): [@(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`<void`(`)`>`&`&`): [@(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