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

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 previous 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!!!!");
}
 
Read Message
Read Message
Previous Topic: Snow2 decoding
Next Topic: Virtual scrolling
Goto Forum:
  


Current Time: Thu Dec 03 22:45:57 GMT+1 2026

Total time taken to generate the page: 0.00753 seconds