File tree 2 files changed +14
-29
lines changed
2 files changed +14
-29
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,19 @@ def get_event_loop(runq_len=0, waitq_len=0):
446
446
447
447
return Loop
448
448
449
+ # CIRCUITPY-CHANGE: added, to match CPython
450
+ def get_running_loop ():
451
+ """Return the event loop used to schedule and run tasks. See `Loop`."""
452
+
453
+ return Loop
454
+
455
+
456
+ def get_event_loop (runq_len = 0 , waitq_len = 0 ):
457
+ # CIRCUITPY-CHANGE: doc
458
+ """Return the event loop used to schedule and run tasks. See `Loop`. Deprecated and will be removed later."""
459
+
460
+ # CIRCUITPY-CHANGE
461
+ return get_running_loop ()
449
462
450
463
def current_task ():
451
464
# CIRCUITPY-CHANGE: doc
Original file line number Diff line number Diff line change @@ -72,32 +72,4 @@ async def wait(self):
72
72
return True
73
73
74
74
75
- # MicroPython-extension: This can be set from outside the asyncio event loop,
76
- # such as other threads, IRQs or scheduler context. Implementation is a stream
77
- # that asyncio will poll until a flag is set.
78
- # Note: Unlike Event, this is self-clearing after a wait().
79
- try :
80
- import io
81
-
82
- class ThreadSafeFlag (io .IOBase ):
83
- def __init__ (self ):
84
- self .state = 0
85
-
86
- def ioctl (self , req , flags ):
87
- if req == 3 : # MP_STREAM_POLL
88
- return self .state * flags
89
- return - 1 # Other requests are unsupported
90
-
91
- def set (self ):
92
- self .state = 1
93
-
94
- def clear (self ):
95
- self .state = 0
96
-
97
- async def wait (self ):
98
- if not self .state :
99
- yield core ._io_queue .queue_read (self )
100
- self .state = 0
101
-
102
- except ImportError :
103
- pass
75
+ # CIRCUITPY: remove ThreadSafeFlag
You can’t perform that action at this time.
0 commit comments