@@ -9,7 +9,8 @@ wishing to modify it.
9
9
10
10
Where the versions differ, this explanation relates to the ` fast_io ` version.
11
11
Differences are largely in ` __init__.py ` : the scheduling algorithm in ` core.py `
12
- is little changed.
12
+ is little changed. Note that the code in ` fast_io ` contains additional comments
13
+ to explain its operation.
13
14
14
15
This doc assumes a good appreciation of the use of ` uasyncio ` . An understanding
15
16
of Python generators is also essential, in particular the use of ` yield from `
@@ -257,6 +258,27 @@ I/O queue has been instantiated.
257
258
258
259
Writing is handled similarly.
259
260
261
+ # Debug code
262
+
263
+ The official ` uasyncio ` contains considerable explicit debug code: schedulers
264
+ are hard to debug. There is code which I believe is for debugging purposes and
265
+ some I have added myself for this purpose. The aim is to ensure that, if an
266
+ error causes a coro to be scheduled when it shouldn't be, an exception is
267
+ thrown. The alternative is weird, hard to diagnose, behaviour.
268
+ These are the instances.
269
+
270
+ [ pend_throw(false)] ( https://github.com/peterhinch/micropython-lib/blob/f20d89c6aad9443a696561ca2a01f7ef0c8fb302/uasyncio.core/uasyncio/core.py#L119 )
271
+ [ also here] ( https://github.com/peterhinch/micropython-lib/blob/f20d89c6aad9443a696561ca2a01f7ef0c8fb302/uasyncio.core/uasyncio/core.py#L123 )
272
+ I think the intention here is to throw an exception (exception doesn't inherit
273
+ from Exception) if it is scheduled incorrectly. Correct scheduling coutermands
274
+ this:
275
+ [ here] ( https://github.com/peterhinch/micropython-lib/blob/819562312bae807ce0d01aa8ad36a13c22ba9e40/uasyncio/uasyncio/__init__.py#L97 )
276
+ [ and here] ( https://github.com/peterhinch/micropython-lib/blob/819562312bae807ce0d01aa8ad36a13c22ba9e40/uasyncio/uasyncio/__init__.py#L114 )
277
+ The ` rdobjmap ` and ` wrobjmap ` dictionary entries are invalidated
278
+ [ here] ( https://github.com/peterhinch/micropython-lib/blob/819562312bae807ce0d01aa8ad36a13c22ba9e40/uasyncio/uasyncio/__init__.py#L91 )
279
+ [ and here] ( https://github.com/peterhinch/micropython-lib/blob/819562312bae807ce0d01aa8ad36a13c22ba9e40/uasyncio/uasyncio/__init__.py#L101 )
280
+ This has the same aim: if an attempt is made incorrectly to reschedule them, an
281
+
260
282
# Modifying uasyncio
261
283
262
284
The library is designed to be extensible. By following these guidelines a
0 commit comments