-
Notifications
You must be signed in to change notification settings - Fork 138
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 feature to use async-std synchronization primitives instead of the ones from tokio #88
Comments
The If you check the Tokio used to be split into various crates (e.g. The only issue I know about is the use of |
I was wondering if you were just worried about the compatibility with the I added the |
I am not super worried about compatibility, I don't think there is or has been an issue with that. I would like tokio to be excluded from the build and compilation if possible. If we don't need it, we don't need it. |
That's the thing. It is needed. The core of deadpool needs semaphores as synchronization primitives. For the semaphore implementation there are currently three popular options:
I checked
I compared the binary size of these three semaphore implementations with a simple program that creates a semaphore, aquires it and releases it in the end: tokiofile size:
futures-intrusivefile size:
async-lockfile size:
TL;DR - Deadpool uses In its current form I need to emphasize this once more: By using |
This sounds like missing functionality in
|
You can check with While checking
Tokio semaphores are fair and have all the features needed by I looked into writing a custom semaphore implementation based on |
Sure, myself and the others here who reacted to the comment are not necessarily the common case user. It would still be nice to have less dependencies if there is already something from an executor ecosystem which should theoretically cover this use case. As I said, it sounds like there is deficiency issues with async-lock. |
The fix for #68 just landed in bcbe567 I might be adding a swappable semaphore implementation in the future using the same technique once there is a fair semaphore implementation available that also supports the low level methods for adding new permits and some kind of closing it for implementing a clean shutdown. I'm currently not planning to work on this as the tokio semaphore works fine for both users of I'm keeping an eye on this but unless |
That's fair. I don't think anyone is in a rush here, just that this would be nice to have. |
…rbo87 Show features of dependencies I keep getting asked why my crate depends on `tokio` besides it just needing a small subset of features: bikeshedder/deadpool#88 This PR adds the list of features used from each dependency to the dependencies tab: ![image](https://user-images.githubusercontent.com/1112569/114195470-c5ce5800-9950-11eb-88c0-8e607a29213d.png)
As I don't see another fair and sound async semaphore implementation being available and I don't plan on writing my own I'm closing this as blocked: |
http-client
now depends on deadpool for keep-alive (connection pooling) support when using it's lightweightasync-h1
backing implementation.That now pulls in
tokio
, which is a bit undesirable when using a different async runtime. It would nice to have feature flags for that, to allow better interoperability with options with the async Rust ecosystem.The text was updated successfully, but these errors were encountered: