Em 27/03/2013 12:09, Thiago Macieira escreveu:
On quarta-feira, 27 de março de 2013 11.20.32, Michael Dougras Silva wrote:
I am a newbie in QT, and I have difficulties in using QThreads. What occurs
is that i created one class named Logger what functions like a stream to a
log file.
This class maintains some static attributes (QFile and QTextStream) what
refers to a log file. I use this class always I want to write logs, but
when I try to use
a Logger inside a QThread, the application crash. I cannot use this class
Logger inside a Thread? How can I fix this?
You can use QFile and QTextStream in a thread. What you can't do is use the
same *objects* from two threads at the same time.
See Qt's definition of "thread-safe" and "reentrant". Those two classes are
reentrant.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
Thanks.
I will study more about QThreads, QMutex and QMutexLocker and try to
restructure my class.
If I have success, I will post the solution here.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest