# Tai Sakuma <tai.sakuma@cern.ch>

##__________________________________________________________________||
class MPEventLoopRunner(object):
    def __init__(self, communicationChannel):
        self.communicationChannel = communicationChannel

    def begin(self):
        self._allReaders = { }

    def run(self, eventLoop):

        # add id so can collect later
        reader = eventLoop.reader
        reader.id = id(reader)
        self._allReaders[id(reader)] = reader

        self.communicationChannel.put(eventLoop)

    def end(self):

        readers = self.communicationChannel.receive()
        for reader in readers:
            self._allReaders[reader.id].setResults(reader.results())

##__________________________________________________________________||

@@ -239,48 +239,32 @@
 nel%0A
-%0A
   
-  def begin(self):%0A
       
-  
 self._
-allR
+original_r
 eade
@@ -272,11 +272,11 @@
 s = 
-%7B %7D
+%5B %5D
 %0A%0A  
@@ -285,180 +285,112 @@
 def 
-ru
+begi
 n(self
-, eventLoop):%0A%0A        # add id so can collect later%0A        reader = eventLoop.reader%0A        reader.id = id(reader)%0A        self._allReaders%5Bid(reader)%5D = 
+): pass%0A%0A    def run(self, eventLoop):%0A        self._original_readers.append(eventLoop.
 reader
-%0A
+)
 %0A   
@@ -455,25 +455,24 @@
 (self):%0A
-%0A
         
 readers 
@@ -463,16 +463,25 @@
         
+returned_
 readers 
@@ -534,25 +534,75 @@
 for 
-reader in 
+original, returned in zip(self._original_readers, returned_
 readers
+)
 :%0A  
@@ -615,35 +615,62 @@
     
-self._allReaders%5Breader.id%5D
+if original is returned: continue%0A            original
 .set
@@ -679,20 +679,22 @@
 sults(re
-ader
+turned
 .results

stop MPEventLoopRunner setting results if returned readers are the same as the original. clean up code