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 do I create a loop for a window to react to volatile changes to a global variable?
Re: How do I create a loop for a window to react to volatile changes to a global variable? [message #54776 is a reply to message #51335] Thu, 10 September 2020 19:13 Go to previous message
JeyCi is currently offline  JeyCi
Messages: 69
Registered: July 2020
Member
Oblivion wrote on Mon, 11 March 2019 12:44
In some cases you may want to create a customized event loop in the main thread.

Yes it helps - thank you for the example.
But first example in your message also works U++ 13664 IN WIN32-MINGW_9.3-compiled - only if using
	void SetArray(int n)
	{
		PostCallback([=](){
			array.Add(n);
			if(n == 10) { // Resize window from within thread...
				SetRect(50, 50, 640, 480);
			}
		});
	}

otherwise, I suppose, I'm getting into deadlock (with GuiLock & even with Call)app don't show changes to arrayCtrl & crashes... I think, that compiler matters!.. MSVC probably could compile ok MT app with GuiLock, or perhaps OS matters (probably Linux can have ok with GuiLock)...
But now with your example I see some possible changes to do to my own code Embarassed - I could'n even assume, that answer is so easy - I thought (in my own code) that I made some mistakes in the code itself... of course will check again... but I agree with your proposal concerning MainThread... thank you for useful advice!
In any case, it seems, that compiler matters for Upp::Thread dealing with??... Shocked
therefore your suggestion seems suitable... thanks


Best regards.

[Updated on: Thu, 10 September 2020 19:26]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: AsyncWork, IsFinished() may not be working properly
Next Topic: Encoding URL for HttpRequest
Goto Forum:
  


Current Time: Sat Jun 07 22:37:28 CEST 2025

Total time taken to generate the page: 0.04795 seconds