Skip to content

Commit fa68e11

Browse files
committed
make more routines async
1 parent bdb94fe commit fa68e11

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

asyncio/core.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def __next__(self):
9292

9393
# Pause task execution for the given time (integer in milliseconds, uPy extension)
9494
# Use a SingletonGenerator to do it without allocating on the heap
95-
def sleep_ms(t, sgen=SingletonGenerator()):
95+
# CIRCUITPY-CHANGE: async
96+
async def sleep_ms(t, sgen=SingletonGenerator()):
9697
# CIRCUITPY-CHANGE: doc
9798
"""Sleep for *t* milliseconds.
9899
@@ -106,7 +107,8 @@ def sleep_ms(t, sgen=SingletonGenerator()):
106107

107108

108109
# Pause task execution for the given time (in seconds)
109-
def sleep(t):
110+
# CIRCUITPY-CHANGE: async
111+
async def sleep(t):
110112
# CIRCUITPY-CHANGE: doc
111113
"""Sleep for *t* seconds
112114

asyncio/funcs.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,15 @@ async def wait_for(aw, timeout, sleep=core.sleep):
7676
raise core.TimeoutError
7777

7878

79-
def wait_for_ms(aw, timeout):
79+
#CIRCUITPY-CHANGE: async
80+
async def wait_for_ms(aw, timeout):
8081
# CIRCUITPY-CHANGE: doc
8182
"""Similar to `wait_for` but *timeout* is an integer in milliseconds.
8283
8384
This is a coroutine, and a MicroPython extension.
8485
"""
8586

86-
return wait_for(aw, timeout, core.sleep_ms)
87+
return await wait_for(aw, timeout, core.sleep_ms)
8788

8889

8990
class _Remove:

0 commit comments

Comments
 (0)