[Qt-interest] efficient Wait for Thread finished?

Thiago Macieira thiago.macieira at trolltech.com
Tue Jan 20 18:10:34 CET 2009


Em Terça-feira 20 Janeiro 2009, às 17:43:27, Matthias Pospiech escreveu:
> Arnold Krille schrieb:
> > How is your simulation transfering the data to the save-thread? Via
> > Qt-ways? Then why not control access to the save-thread with a mutex
> > and use the automatic wait of QMutex::lock() / QMutexLocker()?
>
> I was trying to implement the wait() using a mutex.islocked(). However
> there is no such function.
> So if  I use
>
> void SaveDataThread::saveData()
> {
>    QMutexLocker locker(&mutex);
> ...
> }
>
> how do I test in all the other member functions that the saveData is
> still running? I could not find any such function in Mutex or MutexLocker.

If you can lock the mutex, then saveData isn't running.

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Software Engineer - Nokia, Qt Software
  Qt Software is hiring - ask me
      Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090120/f7c8fdf0/attachment.bin 


More information about the Qt-interest-old mailing list