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

Home » U++ Library support » U++ MT-multithreading and servers » Code before Thread.Run() nor executed
Re: Code before Thread.Run() nor executed [message #48723 is a reply to message #48719] Tue, 29 August 2017 17:20 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
rafiwui wrote on Mon, 28 August 2017 10:51
How exactly does GuiLock work? Because when I tried to implement it in my application it doesn't work. Is there a documentation?
EDIT:
This is part of the code I use:
void MainWindow::Generate()
{
	// Generate
	GuiLock __;
	progress.progressMainLabel.SetText(t_("(0/3) Generating first..."));
	if(!GenerateFirst())
	{
		AbortGeneration(1);
		return;
	}
	progress.progressMain++;
	progress.progressMainLabel.SetText(t_("(1/3) Generating second..."));
	if(!Second())
	{
		AbortGeneration(2);
		return;
	}
	progress.progressMain++;
	progress.progressMainLabel.SetText(t_("(2/3) Generating third..."));
	if(!GenerateThird())
	{
		AbortGeneration(3);
		return;
	}
	progress.progressMain++;
	progress.progressMainLabel.SetText(t_("(3/3) Done"));
}

Instead of showinf every step it just generates all three and at the end updates the gui. So what do I have to change that every step it is updated?


That is because is GUI is blocked while GuiLock is active...

GuiLock is "guard class" - it locks GUI mutex in constructor and releases it in destructor. While that mutex is locked, GUI is stopped and you can meddle with variables that GUI accesses (without using PostCallback).

In above function, you lock GUI at the start of function and unlock it at the end. That is why the GUI is only updated when Generate ends...
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to use TLS over SMTP
Next Topic: HttpRequest ignores server errors
Goto Forum:
  


Current Time: Tue Jun 23 09:34:38 GMT+2 2026

Total time taken to generate the page: 0.00487 seconds