Multithreaded version of interact().
(self)
| 563 | self.write(line) |
| 564 | |
| 565 | def mt_interact(self): |
| 566 | """Multithreaded version of interact().""" |
| 567 | import _thread |
| 568 | _thread.start_new_thread(self.listener, ()) |
| 569 | while 1: |
| 570 | line = sys.stdin.readline() |
| 571 | if not line: |
| 572 | break |
| 573 | self.write(line.encode('ascii')) |
| 574 | |
| 575 | def listener(self): |
| 576 | """Helper for mt_interact() -- this executes in the other thread.""" |