On Mon, May 10, 2021 at 10:59:41AM +0200, Emanuele Giuseppe Esposito wrote: > Divide the fields in AioTaskPool in IN and Status, and > introduce a CoQueue instead of .wait to take care of suspending > and resuming the calling coroutine, and a lock to protect the > busy_tasks counter accesses and the AioTask .ret field.
The thread-safety concerns with the aio_task.h API are unclear to me. The API is designed to have a "main" coroutine that adds task functions to the pool and waits for them to complete. Task functions execute in coroutines (up to the pool's max_busy_tasks limit). It seems like the API was designed to be called only from its main coroutine so why make everything thread-safe? Is there a caller that shares an AioTaskPool between threads? Or will the task functions switch threads somehow? What exactly is the new thread-safety model? Please document it. Unfortunately aio_task.h doesn't have doc comments already but it will be necessary if there are thread-safety concerns.
signature.asc
Description: PGP signature