API Reference


Coroutine Factory

asyncx.just

Creates a coroutine that returns a specified result.

asyncx.wait_any

Creates a coroutine that waits for any of given awaitables to be completed.

asyncx.wait_all

Creates a coroutine that waits for all of given awaitables to be completed.

Shielding

asyncx.shield

A decorator for an async function to protect it from being cancelled.

Context Manager

asyncx.acontext

Creates an async context manager that cancels a given awaitable in __aexit__.

Thread Handling

asyncx.EventLoopThread

An event loop thread that provides thread-safe utility functions.

asyncx.run_coroutine_in_thread

Submit a coroutine in a new thread and waits for its completion in a given loop.

Event Loop

asyncx.dispatch

A decorator to dispatch an async function to another event loop.

asyncx.dispatch_coroutine

Execute the specified coroutine on the specified event loop.

ROS2 Support (rclpy)

asyncx_ros2.aio_to_ros_future

Wrap a asyncio.Future object in a rclpy.task.Future.

asyncx_ros2.concurrent_to_ros_future

Wrap a concurrent.futures.Future object in a rclpy.task.Future.

asyncx_ros2.ros_to_aio_future

Wrap a rclpy.task.Future object in a asyncio.Future.

asyncx_ros2.ensure_aio_future

Wrap an object in a asyncio.Future.

asyncx_ros2.ensure_ros_future

Wrap an object in a rclpy.task.Future.

asyncx_ros2.wrap_as_ros_coroutine

A decorator to wrap an async function running on an asyncio event loop with a rclpy.task.Future.