mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@10643 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5997aa0277
commit
8fce75becd
4 changed files with 16 additions and 5 deletions
|
|
@ -7,7 +7,7 @@ struct Model { // some computation model that is not stateless, abstract definit
|
|||
virtual int Compute() = 0;
|
||||
};
|
||||
|
||||
struct Model1 : Model { // concrete model (there would be more)
|
||||
struct Model1 : Model { // concrete model (there would be more that this one)
|
||||
int n;
|
||||
|
||||
virtual void Start(int i) { n = i; }
|
||||
|
|
@ -19,9 +19,11 @@ CONSOLE_APP_MAIN
|
|||
Vector<int> data;
|
||||
data.SetCount(3000);
|
||||
|
||||
// generate data using some model:
|
||||
|
||||
CoWorkerResources<One<Model>> res;
|
||||
for(auto& r : res)
|
||||
r.Create<Model1>();
|
||||
r.Create<Model1>(); // all should be the same
|
||||
|
||||
CoPartition(0, data.GetCount(), [&data, &res](int l, int h) {
|
||||
Model& m = *~res; // gets resource unique for worker
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
description "CoWorkerResources provide per-worker-thread context\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue