[Neo-report] r2391 vincent - /trunk/neo/neoctl/neoctl.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 1 11:59:17 CET 2010


Author: vincent
Date: Mon Nov  1 11:59:16 2010
New Revision: 2391

Log:
Do not use a busy loop.

Also, improve exit condition readability.

Modified:
    trunk/neo/neoctl/neoctl.py

Modified: trunk/neo/neoctl/neoctl.py
==============================================================================
--- trunk/neo/neoctl/neoctl.py [iso-8859-1] (original)
+++ trunk/neo/neoctl/neoctl.py [iso-8859-1] Mon Nov  1 11:59:16 2010
@@ -40,10 +40,11 @@ class NeoCTL(object):
         if not self.connected:
             self.connection = ClientConnection(self.em, self.handler, 
                     addr=self.server, connector=self.connector_handler())
-            while not self.connected and self.connection is not None:
-                # XXX: this burn the CPU
-                self.em.poll(0)
-            if self.connection is None:
+            while self.connection is not None:
+                if self.connected:
+                    break
+                self.em.poll(1)
+            else:
                 raise NotReadyException('not connected')
         return self.connection
 





More information about the Neo-report mailing list