Hi,
I am updating the status of a worker thread in GUI using the following code:
while(!grabber->bGrabberFinished)
{
ui->statusBar->showMessage(grabber->status);
ui->label->setText(grabber->status);
ui->label->update();
ui->progressBar->setValue(grabber->progress);
ui->progressBar->update();
boost::this_thread::sleep (boost::posix_time::milliseconds(40));
}
while(!grabber->bGrabberFinished)
{
ui->statusBar->showMessage(grabber->status);
ui->label->setText(grabber->status);
ui->label->update();
ui->progressBar->setValue(grabber->progress);
ui->progressBar->update();
boost::this_thread::sleep (boost::posix_time::milliseconds(40));
}
To copy to clipboard, switch view to plain text mode
Here, my worker thread updates the grabber object's progress and status (so the grabber object is shared between the GUI thread and the worker thread).
Everything works fine (my GUI is updated at regular intervals), but during this process, Windows blacks out my screen as "not responding" even though the label is updated every 40 milliseconds...
What am I doing wrong?
Thanks,
Chytu.
Bookmarks