Hello guys,
how is possible pause and then resume thread in QT?
My application starts http proxy server in new thread and in some moments I need pause the thread with proxy and get/set data from comunication process between client and server.
I tried this,
proxy::proxy(sqlitt * sq) {
pending = false;
}
void proxy::run(){
smw = new sslMeatWrapper(this);
}
// this method is called from sslMeatWrapper when new request arrives
void proxy::proxyRequest() {
qDebug << "Incoming proxy request";
pending = true;
// in this moment I need to pause thread and get/set data from/to smw object
while (pending)
msleep(1000);
}
proxy::proxy(sqlitt * sq) {
pending = false;
}
void proxy::run(){
smw = new sslMeatWrapper(this);
}
// this method is called from sslMeatWrapper when new request arrives
void proxy::proxyRequest() {
qDebug << "Incoming proxy request";
pending = true;
// in this moment I need to pause thread and get/set data from/to smw object
while (pending)
msleep(1000);
}
To copy to clipboard, switch view to plain text mode
In GUI class there is a slot
void sqlitt::next() {
pr->pending = true;
}
void sqlitt::next() {
pr->pending = true;
}
To copy to clipboard, switch view to plain text mode
but this is not working. The thread is stocked on while statement i suppose. Can you please advice?
Thanks
Bookmarks