Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extmod: add new implementation of uasyncio #5332

Merged
merged 21 commits into from Mar 25, 2020

Commits on Mar 25, 2020

  1. py/mpconfig.h: Enable MICROPY_MODULE_GETATTR by default.

    To enable lazy loading of submodules (among other things), which is very
    useful for MicroPython libraries that want to have optional subcomponents.
    
    Disabled explicitly on minimal ports.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    f8fc786 View commit details
    Browse the repository at this point in the history
  2. qemu-arm: Set default board as mps2-an385 to get more flash for tests.

    And use Ubuntu bionic for qemu-arm Travic CI job.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    ab00f4c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    98ab764 View commit details
    Browse the repository at this point in the history
  4. py/pairheap: Properly unlink node on pop and delete.

    This fixes a bug in the pairing-heap implementation when nodes are deleted
    with mp_pairheap_delete and then reinserted later on.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    c47a3dd View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6c7e78d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    f9741d1 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f05ae41 View commit details
    Browse the repository at this point in the history
  8. extmod/uasyncio: Add new implementation of uasyncio module.

    This commit adds a completely new implementation of the uasyncio module.
    The aim of this version (compared to the original one in micropython-lib)
    is to be more compatible with CPython's asyncio module, so that one can
    more easily write code that runs under both MicroPython and CPython (and
    reuse CPython asyncio libraries, follow CPython asyncio tutorials, etc).
    Async code is not easy to write and any knowledge users already have from
    CPython asyncio should transfer to uasyncio without effort, and vice versa.
    
    The implementation here attempts to provide good compatibility with
    CPython's asyncio while still being "micro" enough to run where MicroPython
    runs. This follows the general philosophy of MicroPython itself, to make it
    feel like Python.
    
    The main change is to use a Task object for each coroutine.  This allows
    more flexibility to queue tasks in various places, eg the main run loop,
    tasks waiting on events, locks or other tasks.  It no longer requires
    pre-allocating a fixed queue size for the main run loop.
    
    A pairing heap is used to queue Tasks.
    
    It's currently implemented in pure Python, separated into components with
    lazy importing for optional components.  In the future parts of this
    implementation can be moved to C to improve speed and reduce memory usage.
    But the aim is to maintain a pure-Python version as a reference version.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    63b9944 View commit details
    Browse the repository at this point in the history
  9. tests/extmod: Add uasyncio tests.

    All .exp files are included because they require CPython 3.8 which may not
    always be available.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    c4935f3 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    5d09a40 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3667eff View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    18fa65e View commit details
    Browse the repository at this point in the history
  13. tests/multi_net: Add uasyncio test for TCP server and client.

    Includes a test where the (non uasyncio) client does a RST on the
    connection, as a simple TCP server/client test where both sides are using
    uasyncio, and a test for TCP stream close then write.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    38904b8 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    081d067 View commit details
    Browse the repository at this point in the history
  15. extmod/uasyncio: Add optional implementation of core uasyncio in C.

    Implements Task and TaskQueue classes in C, using a pairing-heap data
    structure.  Using this reduces RAM use of each Task, and improves overall
    performance of the uasyncio scheduler.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    bc009fd View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    91dd394 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    c99322f View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    3b68f36 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    35e2dd0 View commit details
    Browse the repository at this point in the history
  20. esp8266: Enable and freeze uasyncio.

    Only included in GENERIC build.
    dpgeorge committed Mar 25, 2020
    Configuration menu
    Copy the full SHA
    1d4d688 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    ad004db View commit details
    Browse the repository at this point in the history