Skip to content

Synchronous IO #1503

@hoodmane

Description

@hoodmane

Tons of existing APIs for IO are synchronous. For instance, the http.server API #140. Also, basic things like input() and any tool that expects to do CLI interaction are based around synchronous IO.

@joemarshall has implemented a solution to this here: https://github.com/joemarshall/unthrow
It would be a huge improvement to incorporate this approach.

I guess what's going on here is that normal blocking IO works by asking the OS to halt your thread and leave your stack alone then get back to you with the answer when it's ready. Asyncio works by asking everything on the stack to produce a continuation to rewind the stack. When IO is needed, the stack is unwound and when the result is ready it is rewound. "unthrow" works by guessing how to rewind the stack when it only has pure Python code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions