Open Kswin01 opened 4 months ago
One issue is that while inputting ^C will kill executions that wait for IO, it won't do anything for executions that don't. Example:
Inputting ^C will kill
async def f():
await asyncio.sleep(10)
asyncio.run(f())
but won't kill
for i in range(100000):
print(i)
One issue is that while inputting ^C will kill executions that wait for IO, it won't do anything for executions that don't. Example:
Inputting ^C will kill
async def f(): await asyncio.sleep(10) asyncio.run(f())
but won't kill
for i in range(100000): print(i)
That's correct, if we never switch to the t_event co-routine, we will never process input and therefore not receive the keyboard interrupts. We couldn't think of a great way to deliver these characters within the current design.
This PR adapts the micropython port to support keyboard interrupts. We buffer the input characters from the sDDF serial subsystem in internal micropython buffers, so that we can process interrupt chars as they come in. We then read characters from our internal buffers when reads are requested. The transmit path remains unchanged.