|
|
|
|
|
by pandaxtc
206 days ago
|
|
Sorry if I've got this wrong, but wouldn't the first example behave the same way in Javascript as well? The function parent() "awaits" the completion of child(), so it wouldn't be possible to interleave the print statements. The example from this StackOverflow question might be a better demonstration: https://stackoverflow.com/q/63455683 |
|
> My mutation block contained no awaits. The only awaits happened before acquiring the lock. Therefore:
> * The critical section was atomic relative to the event loop.
> * No other task could interleave inside the mutation.
> * More locks would not increase safety.
That is exactly the same as with e.g. JS. I'm sure there are lot of subtle differences in how Python does async vs others, but the article fails to illuminate any of it; neither the framing story nor the examples really clarify anything