mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@14413 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
41f5da77ed
commit
58d2bd8a9e
3 changed files with 15 additions and 16 deletions
11
reference/CoWorkCoDo/CoWorkCoDo.upp
Normal file
11
reference/CoWorkCoDo/CoWorkCoDo.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Demonstrates CoDo parallelization\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
CoWorkLoop.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -14,18 +14,17 @@ CONSOLE_APP_MAIN
|
|||
}
|
||||
|
||||
double sum = 0;
|
||||
CoWork co;
|
||||
co * [&] {
|
||||
std::atomic<int> ii(0);
|
||||
CoDo([&] {
|
||||
double m = 0;
|
||||
int i;
|
||||
while((i = co.Next()) < data.GetCount()) {
|
||||
for(int i = ii++; i < data.GetCount(); i = ii++) {
|
||||
CParser p(data[i]);
|
||||
while(!p.IsEof())
|
||||
m += p.ReadDouble();
|
||||
}
|
||||
CoWork::FinLock();
|
||||
sum += m;
|
||||
};
|
||||
});
|
||||
|
||||
RDUMP(sum);
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
description "Demonstrates Loop (aka operator *) method\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
CoWorkLoop.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue