Hi,
I have a small QT application that needs to serialize some data periodically. I'm using a QThread with QMutex to protect my resources.
Here is the code I use inside my QThread. I don't know why but it writes no data at all in the file.
Code:
voidCDataLogger::run(){staticGeneralInformationstoto;
QDataStreamout(m_File);//wewillserializethedataintothefile
while(MustRun){m_Mutex->lock();
out<<45;out<<45;out<<45;out<<45;out<<45;out<<45;out<<45;out<<45;
m_Mutex->unlock();this->sleep(1);}}
The m_File object is a QFile object pointer receive by the Main Thread. If I use the same code in the main thread, all data is written in the file but if I use it inside another thread, the file stays empty. Is it because the new thread needs some kind of privileges?
I need help on this.
Thank you in advance,
Bookmarks