mercredi 24 février 2016

Is it safe to call self in std::async

I would like to check Mysql connections are alive. (using Mysql-connector-c++)

so.. I call "check function" every 5 minutes

like this

void checkConnection()
{
    std::this_thread::sleep_for(std::chrono::minutes(5));
    // -- check connection
    std::async(std::launch::async, checkConnection); // Here
}

Is it safe..??

Aucun commentaire:

Enregistrer un commentaire