quininer / ritsu

An experimental asynchronous runtime based on `io-uring`.
MIT License
76 stars 4 forks source link

trivial temporary object allocation #3

Closed quininer closed 4 years ago

quininer commented 4 years ago

io-uring needs to allocate many trivial objects for sqe, such as timeout, iovec, sendmsg.

IORING_FEAT_SUBMIT_STABLE doesn't help us much because we don't submit immediately. We'd better use an slab allocator for this.

quininer commented 4 years ago

If we use a thread local slab, then we must deal with thread exit, otherwise it may cause UB.

quininer commented 4 years ago

Using thread_local will break thread safety of future, and I haven't solved idea yet.

quininer commented 4 years ago

We can reuse an object as much as possible. see https://github.com/quininer/ritsu/blob/master/src/action/timeout.rs#L7