|
@@ -2,10 +2,8 @@
|
2
|
2
|
import collections
|
3
|
3
|
from copy import copy
|
4
|
4
|
from multiprocessing import Queue
|
5
|
|
-
|
6
|
5
|
from multiprocessing import Process
|
7
|
6
|
from queue import Empty
|
8
|
|
-
|
9
|
7
|
import time
|
10
|
8
|
|
11
|
9
|
from synergine2.base import BaseObject
|
|
@@ -101,15 +99,19 @@ class Terminal(BaseObject):
|
101
|
99
|
pass
|
102
|
100
|
|
103
|
101
|
def read(self):
|
|
102
|
+ self.logger.debug('Read package from core')
|
104
|
103
|
while True:
|
105
|
104
|
try:
|
106
|
105
|
package = self._input_queue.get(block=False, timeout=None)
|
107
|
106
|
if package == STOP_SIGNAL:
|
|
107
|
+ self.logger.debug('Stop required')
|
108
|
108
|
self._stop_required = True
|
109
|
109
|
return False
|
110
|
110
|
|
|
111
|
+ self.logger.debug('Package received')
|
111
|
112
|
self.receive(package)
|
112
|
113
|
except Empty:
|
|
114
|
+ self.logger.debug('No package')
|
113
|
115
|
return True # Finished to read Queue
|
114
|
116
|
|
115
|
117
|
def receive(self, package: TerminalPackage):
|
|
@@ -119,6 +121,7 @@ class Terminal(BaseObject):
|
119
|
121
|
self.send(TerminalPackage(is_cycle=True))
|
120
|
122
|
|
121
|
123
|
def send(self, package: TerminalPackage):
|
|
124
|
+ self.logger.debug('Send package to core')
|
122
|
125
|
self._output_queue.put(package)
|
123
|
126
|
|
124
|
127
|
def register_event_handler(self, event_class, func):
|