[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: KFile plugin problem !!
From: Michael Pyne <pynm0001 () comcast ! net>
Date: 2004-07-12 13:29:21
Message-ID: 200407120929.23836.pynm0001 () comcast ! net
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 12 July 2004 09:12, Mario wrote:
> Hmm, I have to wait until readyRead is emitted, this will be hard to
> implement.
Try using QMutex, adding it to your subclass as a member variable. For
example, (assuming it's called m_lock):
void KFileSubclass::readyReadStdout(...)
{
// Collect data FIRST!!
...
// After everything is done, unlock the mutex
m_lock.unlock(); // Allow execution to continue
}
void KFileSubclass::readInfo()
{
// Get your KProcess object ready.
...
// Lock the mutex. You can't lock it again until readyReadStdout()
// unlocks it
m_lock.lock();
// Start the KProcess object
...
// Try to lock the Mutex again. Once we are past this line,
// readyReadStdout() is guaranteed to be done if it is the only
// unlocker.
m_lock.lock();
// Now set the metadata fields.
...
// Don't forget to unlock the mutex when done.
m_lock.unlock();
}
I'll let you work it into the code, but the idea is to use the mutex as sort
of a dam to keep your flow of code execution controlled.
Regards,
- Michael Pyne
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFA8pIxqjQYp5Omm0oRAtO+AJ4vFtVv/c/9fvBYs6WRlRCj0cGDMQCfb4NQ
9ke1E3tZQsxt8/YWKHh9WxM=
=0bn1
-----END PGP SIGNATURE-----
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic