From 812770a1b35cf971a05b1b8cc30a90dad273383e Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Tue, 24 Nov 2015 11:21:01 +0000
Subject: [PATCH] Task #8798: moved waitForInterrupt to utils. It's not a class
 method.

---
 LCS/Messaging/python/common/util.py       | 14 ++++++++++++++
 LCS/Messaging/python/messaging/Service.py | 13 -------------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/LCS/Messaging/python/common/util.py b/LCS/Messaging/python/common/util.py
index 100ac836e25..3664c82cb8e 100644
--- a/LCS/Messaging/python/common/util.py
+++ b/LCS/Messaging/python/common/util.py
@@ -25,6 +25,7 @@ This package contains different utilities that are common for LOFAR software
 """
 
 import sys
+import time
 
 
 def check_bit(value, bit):
@@ -112,3 +113,16 @@ def isFloatList(lst):
     if not isinstance(lst, list):
         return False
     return all(isinstance(x, float) for x in lst)
+
+
+def waitForInterrupt():
+    """
+    Useful (low cpu load) loop that waits for keyboard interrupt.
+    """
+    while True:
+        try:
+            time.sleep(10)
+        except KeyboardInterrupt:
+            break
+
+
diff --git a/LCS/Messaging/python/messaging/Service.py b/LCS/Messaging/python/messaging/Service.py
index 1c759817b8d..6f5e179845d 100644
--- a/LCS/Messaging/python/messaging/Service.py
+++ b/LCS/Messaging/python/messaging/Service.py
@@ -210,19 +210,6 @@ class Service(object):
             self.connected = False
 
 
-    def wait_for_interrupt(self):
-        """
-        Useful (low cpu load) loop that waits for keyboard interrupt.
-        """
-        looping = True
-        while looping:
-            try:
-                time.sleep(10)
-            except KeyboardInterrupt:
-                looping = False
-                logger.info("Keyboard interrupt received.")
-
-
     def __enter__(self):
         """
         Internal use only. Handles scope with keyword 'with'
-- 
GitLab