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

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/utils
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2008-03-07 17:46:43
Message-ID: 1204912003.690273.11189.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 783294 by osterfeld:

merge livelock fix from gpgme kdpipeiodevice copy

 M  +11 -7     kdpipeiodevice.cpp  


--- trunk/KDE/kdepim/kleopatra/utils/kdpipeiodevice.cpp #783293:783294
@@ -111,6 +111,7 @@
     bool error;
     bool eofShortCut;
     int errorCode;
+    bool isReading;
     bool consumerBlocksOnUs;
 
 private:
@@ -131,6 +132,7 @@
     error( false ),
     eofShortCut( false ),
     errorCode( 0 ),
+    isReading( false ),
     consumerBlocksOnUs( false ),
     rptr( 0 ),
     wptr( 0 )
@@ -332,24 +334,24 @@
 
 void KDPipeIODevice::Private::emitReadyRead()
 {
-    static int s_counter = 0;
-    const int counter = s_counter++;
     QPointer<Private> thisPointer( this );
-    qDebug( "KDPipeIODevice::Private::emitReadyRead %p, %d", this, counter );
+    qDebug( "KDPipeIODevice::Private::emitReadyRead %p", this );
 
     emit q->readyRead();
 
     if ( !thisPointer )
         return;
-
+    bool mustNotify = false;
     if ( reader ) {
-        qDebug( "KDPipeIODevice::Private::emitReadyRead %p, %d: locking reader \
(CONSUMER THREAD)", this, counter ); +        qDebug( \
"KDPipeIODevice::Private::emitReadyRead %p: locking reader (CONSUMER THREAD)", this \
);  synchronized( reader ) {
-            qDebug( "KDPipeIODevice::Private::emitReadyRead %p, %d: locked reader \
(CONSUMER THREAD)", this, counter ); +            qDebug( \
"KDPipeIODevice::Private::emitReadyRead %p: locked reader (CONSUMER THREAD)", this ); \
reader->readyReadSentCondition.wakeAll(); +            mustNotify = \
!reader->bufferEmpty() && reader->isReading; +            qDebug( \
"KDPipeIODevice::Private::emitReadyRead %p: buffer empty: %d reader in ReadFile: %d", \
this, reader->bufferEmpty(), reader->isReading );              }
     }
-    qDebug( "KDPipeIODevice::Private::emitReadyRead %p leaving %d", this, counter );
+    qDebug( "KDPipeIODevice::Private::emitReadyRead %p leaving", this );
 
 }
 
@@ -743,10 +745,12 @@
 
             qDebug( "%p: Reader::run: trying to read %d bytes", this, numBytes );
 #ifdef Q_OS_WIN32
+            isReading = true;
             mutex.unlock();
             DWORD numRead;
             const bool ok = ReadFile( handle, buffer + wptr, numBytes, &numRead, 0 \
);  mutex.lock();
+            isReading = false;
             if ( ok ) {
                 if ( numRead == 0 ) {
                     qDebug( "%p: Reader::run: got eof (numRead==0)", this );


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

Configure | About | News | Add a list | Sponsored by KoreLogic