[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: KFile plugin problem !!
From:       Mario <tweakBSD () gmx ! net>
Date:       2004-07-12 13:55:48
Message-ID: 200407121555.48984.tweakBSD () gmx ! net
[Download RAW message or body]

Am Montag, 12. Juli 2004 15:29 schrieb Michael Pyne:
> -----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 <<

I have tried to figure it in but now I have following compile errors !

request for member `lock' in `
   this->tweakBSDpkgPlugin::m_lock', which is of non-aggregate type `QMutex*'

should I change m_lock.lock() to m_lock->lock() ???
 
>> 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