Hi.
I have wrote some the thread run loop where i every iteration select some data from my database. In every iteration fisrt i check if database is open. if it open i am quering. Code looks like this.
Qt Code:
void MyThread::run() { while (m_running) { // In this code if /etc/init.d/network stop (network closed) db.isOpen() returns true. if (db.isOpen()) { // some code } msleep(1000); } }To copy to clipboard, switch view to plain text mode
But, for testing i close the network, in linux using /etc/init.d/network stop. In this case db.isOpen() return true and in my query.exec() my program frozes in exec code.
How can i detect in this case that connection is stil open or network works or databse in remote server is not stopped?
Thanks.
Bookmarks