Skip to content

Thread Safety of Built-in Types

aync-kernel utilises aiologic for its thread-safe primitives.

async_kernel.pending.Pending

Guarantees

  • Internally synchronised

    • All Public methods can be safely called from any thread.
    • Instance are sync/async awaitable from any thread with any backend.
  • Limitations

    add_done_callback: The callback is called from the thread in which it is set so should provide it's own synchronisation as needed.

async_kernel.caller.Caller

Caller is thread-local in CPython and context-local in Pyodide.

Guarantees

  • Internally synchronised

  • Limitations

    • queue_call is internally synchronised per-function after the first call (per-function) has returned.

async_kernel.common.Fixed

Guarantees

  • Internally synchronised

Other classes

TODO