Bastien Sevajol 6 gadus atpakaļ
vecāks
revīzija
17a50eb357
2 mainītis faili ar 11 papildinājumiem un 7 dzēšanām
  1. 10 7
      synergine2/processing.py
  2. 1 0
      synergine2/share.py

+ 10 - 7
synergine2/processing.py Parādīt failu

@@ -52,13 +52,16 @@ class Worker(object):
52 52
     def work(self, *args, **kwargs):
53 53
         seed_value = kwargs.pop('seed')
54 54
         random.seed(seed_value)
55
-        while True:
56
-            args = self.process_read_pipe.recv()
57
-            if args == STOP:
58
-                return
59
-
60
-            result = self.real_job(*args)
61
-            self.local_write_pipe.send(result)
55
+        try:
56
+            while True:
57
+                args = self.process_read_pipe.recv()
58
+                if args == STOP:
59
+                    return
60
+
61
+                result = self.real_job(*args)
62
+                self.local_write_pipe.send(result)
63
+        except KeyboardInterrupt:
64
+            return
62 65
 
63 66
 
64 67
 class ProcessManager(BaseObject):

+ 1 - 0
synergine2/share.py Parādīt failu

@@ -144,6 +144,7 @@ class SharedDataManager(object):
144 144
         self._data = {}
145 145
 
146 146
     def set(self, key: str, value: typing.Any) -> None:
147
+        # FIXME: Called tout le temps !
147 148
         self._data[key] = value
148 149
         self._modified_keys.add(key)
149 150