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  |
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!!!!");
}
|
|
|
Goto Forum:
Current Time: Tue May 06 21:51:12 CEST 2025
Total time taken to generate the page: 0.03663 seconds
|