Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add push_multiple #56

Closed
wants to merge 2 commits into from
Closed

Add push_multiple #56

wants to merge 2 commits into from

Conversation

Kestrer
Copy link
Contributor

@Kestrer Kestrer commented Jan 17, 2021

Currently concurrent io_uring instances can't really be used to send linked SQEs because another thread could call push in between one thread calling push twice. This PR adds a new function, push_multiple, to allow pushing multiple SQEs atomically.

Since it's not easy to pass in an arbitrary number of owned values to a function in Rust yet, I decided that it would be better to make squeue::Entry Copy so that it wouldn't be inconsistent to take both Entry and &[Entry]. And since we no longer need to return back ownership of the Entry when the queue is full, the push functions return bools instead of Result<(), Entry> - although they could also return Result<(), ()>. Actually, after further thought I have decided to use Result<(), ()> because it has more obvious semantics and it is #[must_use].

@quininer
Copy link
Member

I want to put it aside for now, until we decide on the future of concurrent module.

@quininer
Copy link
Member

Unless the kernel supports it, it is difficult for us to provide meaningful concurrent mod.

This PR will allow developers to lock sq by themselves. maybe one day kernel will support concurrent queues, and then we can bring back concurrent mod. .

@quininer quininer closed this Feb 10, 2021
@Kestrer Kestrer deleted the push-multiple branch February 10, 2021 14:13
@quininer
Copy link
Member

quininer commented Feb 12, 2021

I'm considering adding this to normal sq and cq, it will have some performance advantages (batch submit see #65), and I find it useful when writing links like write + flush.

@quininer quininer mentioned this pull request Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants