Home » U++ Library support » U++ MT-multithreading and servers » How to use CoWork and Progress together?
Re: How to use CoWork and Progress together? [message #53554 is a reply to message #53540] |
Sat, 11 April 2020 11:14 |
Tom1
Messages: 1216 Registered: March 2007
|
Senior Contributor |
|
|
Hi Mirek,
This is a nice and stylish improvement!
However, there is still something to fix as using this through a menu leaves the app frozen at or near the completion of parallel processing. Here's a testcase based on the reference example:
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class Test: public TopWindow{
public:
typedef Test CLASSNAME;
MenuBar menu;
void Worker(){
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();
}
});
}
void MainMenu(Bar &bar){
bar.Add("Process...", THISFN(Worker));
}
Test(){
AddFrame(menu);
menu.Set([=](Bar& bar) { MainMenu(bar); });
}
};
GUI_APP_MAIN
{
Test test;
test.Run();
}
Thanks and best regards,
Tom
|
|
|
|
|
How to use CoWork and Progress together?
By: Tom1 on Tue, 07 April 2020 14:58
|
|
|
Re: How to use CoWork and Progress together?
By: Tom1 on Tue, 07 April 2020 16:39
|
|
|
Re: How to use CoWork and Progress together?
By: mirek on Thu, 09 April 2020 10:41
|
|
|
Re: How to use CoWork and Progress together?
By: mirek on Thu, 09 April 2020 13:13
|
|
|
Re: How to use CoWork and Progress together?
By: mirek on Thu, 09 April 2020 14:01
|
|
|
Re: How to use CoWork and Progress together?
By: Tom1 on Sat, 11 April 2020 11:14
|
|
|
Re: How to use CoWork and Progress together?
By: mirek on Sat, 11 April 2020 23:10
|
|
|
Re: How to use CoWork and Progress together?
By: Tom1 on Mon, 13 April 2020 09:52
|
|
|
Re: How to use CoWork and Progress together?
By: deep on Mon, 13 April 2020 12:41
|
|
|
Re: How to use CoWork and Progress together?
By: mirek on Mon, 13 April 2020 13:26
|
|
|
Re: How to use CoWork and Progress together?
By: deep on Mon, 13 April 2020 14:05
|
Goto Forum:
Current Time: Thu May 16 11:46:19 CEST 2024
Total time taken to generate the page: 0.02332 seconds
|