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 » Community » Newbie corner » Sequential process expected (I just want to add a sequential process using a list control)
Sequential process expected [message #58344] Tue, 03 May 2022 18:22 Go to next message
mrk10000 is currently offline  mrk10000
Messages: 7
Registered: April 2022
Promising Member
I wrote the following code and i just want to "first print Connection to server.." and then when DB connection is done, want to print "Connection successfull" but it prints both at the same tiem until DBConnect() function ends, i have tried to separed it using the thread but still the same behaviour, someone could give some idead please, thanks


------------------------------------------------------------ ----------------
this->cllog.Add("Connecting to the server...");
this->GetTopCtrl()->Refresh();


//GuiUnlock LeaveGUIriticalEn;
this->cllog.ScrollTo( this->cllog.GetCount() );
Sleep(1000);
bool res = false;

auto c = Async([&] -> bool {
return mServerManager.DBConnect();
});

try
{
res = c.Get();
}
catch(...)
{
LOG("Error while trying exceptions");
}

if( res == true )
{
this->cllog.Add("Connection successfull!!!!");
}
else
{
this->cllog.Add("Connection failed!!!!");
}
Re: Sequential process expected [message #58351 is a reply to message #58344] Thu, 05 May 2022 22:37 Go to previous message
mrk10000 is currently offline  mrk10000
Messages: 7
Registered: April 2022
Promising Member
It follows the expected execution only when i added MessageCtrl notifications, seems like detaching the current thread or similar Sad

[Updated on: Wed, 11 May 2022 03:48]

Report message to a moderator

Previous Topic: Snow2 decoding
Next Topic: Virtual scrolling
Goto Forum:
  


Current Time: Sat Jun 15 07:12:34 CEST 2024

Total time taken to generate the page: 0.02278 seconds