glebpom/linux-aio-tokio

Consider switching to getting the reference to LockedBuf in AIO operaions

Closed this issue · 1 comments

That was initially implemented but could lead to UB due to the drop of mmaped memory during the ongoing request. In order to prevent it, we can use Arc, and create a clone hidden behind some private type, and keep it in the Request. This will prevent early drop of the buffer, and extend its lifetime at least till the date gets back from the kernel

The downside of this is some extra-cost of Arc and Mutex, which will be required to get mutable access to the buffer. Since there is no contention, Mutex from parking_lot should not introduce much overhead, but we should consider use atomics directly in the future

Closed by #12