ultimatepp/autotest/CoWork/CoWork.cpp
cxl 5c86036124 .reorganizing
git-svn-id: svn://ultimatepp.org/upp/trunk@9759 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2016-05-01 20:21:16 +00:00

27 lines
409 B
C++

#include <Core/Core.h>
using namespace Upp;
void Do() {
Vector<int> h;
CoWork co;
for(int i = 0; i < 1000000; i++)
co & [&] { INTERLOCKED { h.Add(Random()); } };
LOG("Exit Do");
}
CONSOLE_APP_MAIN
{
Thread a, b, c;
a.Run(callback(Do));
b.Run(callback(Do));
c.Run(callback(Do));
Do();
a.Wait();
b.Wait();
c.Wait();
LOG("Exit main");
LOG("=============== OK");
}