U++ framework
Do not panic. Ask here before giving up.

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: 14291
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 May 25 03:12:39 GMT+2 2026

Total time taken to generate the page: 0.00615 seconds