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 #53514 is a reply to message #53511] |
Tue, 07 April 2020 16:39   |
Tom1
Messages: 1305 Registered: March 2007
|
Ultimate Contributor |
|
|
Hi,
I finally found the solution:
Progress pg;
pg.Title("A parallel processing job");
pg.SetText("Working on many items at once...");
pg.Set(0, 100);
Atomic done=0;
Atomic stop=0;
CoWork co;
for(int t=0;t<co.GetPoolSize();t++){
co & [&] {
for(int i = AtomicInc(done); i<100;i = AtomicInc(done)){
Sleep(1000); // Doing something...
if(stop) break;
}
};
}
while(!co.IsFinished()){
if(pg.Canceled()){
AtomicInc(stop);
break;
}
pg.SetPos(done);
Sleep(100);
}
co.Finish();
So, in the end I did have to give up the CoWork::Loop (operator *) and do approximately the same externally to avoid internal co.Finish(); Now the GUI is accessed entirely in the main thread and there are no more issues.
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: Tue Jul 08 23:21:17 CEST 2025
Total time taken to generate the page: 0.04274 seconds
|