mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-27 22:03:43 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@14284 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ba5d8b4278
commit
e48dd8ea04
2 changed files with 30 additions and 0 deletions
19
reference/ParallelProgress/main.cpp
Normal file
19
reference/ParallelProgress/main.cpp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
Progress pi("Working on many items at once...", 100);
|
||||
std::atomic<int> ii(0);
|
||||
CoDo([&] {
|
||||
for(int i = ii++; i < 100; i = ii++) {
|
||||
for(int q = 0; q < 1000; q++) {
|
||||
if(pi.Canceled()) // ideally call canceled every 1-10ms
|
||||
return;
|
||||
Sleep(1); // work simulation
|
||||
}
|
||||
pi.Step();
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue