How can I properly run 2 threads that await things at the same time?
问题 Basically, I have 2 threads, receive and send. I want to be able to type a message, and whenever I get a new message it just gets 'printed above the line I am typing in'. first what I thought would work, and you can just paste this it will run: import multiprocessing import time from reprint import output import time import random import sys def receiveThread(queue): i = 0 while True: queue.put(i) i+=1 time.sleep(0.5) def sendThread(queue): while True: a = sys.stdin.read(1) if (a != ""):