Starts a message loop which parses incoming messages and invokes handlers for them on a background thread, until the channel is closed. Incoming messages, including responses to requests, will not be processed at all until this is invoked.
(self)
| 1137 | self.stream.close() |
| 1138 | |
| 1139 | def start(self): |
| 1140 | """Starts a message loop which parses incoming messages and invokes handlers |
| 1141 | for them on a background thread, until the channel is closed. |
| 1142 | |
| 1143 | Incoming messages, including responses to requests, will not be processed at |
| 1144 | all until this is invoked. |
| 1145 | """ |
| 1146 | |
| 1147 | assert not self.started |
| 1148 | self.started = True |
| 1149 | |
| 1150 | self._parser_thread = threading.Thread( |
| 1151 | target=self._parse_incoming_messages, name=f"{self} message parser" |
| 1152 | ) |
| 1153 | |
| 1154 | hide_thread_from_debugger(self._parser_thread) |
| 1155 | self._parser_thread.daemon = True |
| 1156 | self._parser_thread.start() |
| 1157 | |
| 1158 | def wait(self): |
| 1159 | """Waits for the message loop to terminate, and for all enqueued Response |