Enter the context, creating the read thread and setting up tracing if needed.
(self)
| 268 | return self._trace_call |
| 269 | |
| 270 | def __enter__(self): |
| 271 | """Enter the context, creating the read thread and setting up tracing if needed.""" |
| 272 | self.read_thread = threading.Thread(target=self._read_thread_func) |
| 273 | self.read_thread.start() |
| 274 | |
| 275 | if self.call_selector is not None: |
| 276 | threading.settrace(self._trace_call) |
| 277 | sys.settrace(self._trace_call) |
| 278 | |
| 279 | return self |
| 280 | |
| 281 | def __exit__(self, exc_type, exc_value, traceback): |
| 282 | """Terminate the read thread cleanly and reset tracing if needed.""" |