Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 #53540 is a reply to message #53539] Thu, 09 April 2020 14:01 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
So now some Progress methods can be called without restriction in MT.

This is a new reference example:

#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();
		}
	});
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [NOT REPRODUCIBLE] HttpRequest gzip format error
Next Topic: ASyncWork/CoWork Cancel() method leads to deadlock (when used with GuiLock)
Goto Forum:
  


Current Time: Mon Aug 25 20:52:49 CEST 2025

Total time taken to generate the page: 0.06302 seconds