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 Go to next message](theme/default/images/down.png) |
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: Sat Jul 27 03:21:02 CEST 2024
Total time taken to generate the page: 0.01553 seconds
|