-
Notifications
You must be signed in to change notification settings - Fork 5
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
Arc::ptr_eq
equivalent for Stealer/Worker
#2
Comments
Arc::ptr_eq
equivalent for Stealer/Worker
Hi, thanks for filing the issue and for the PR. I would be OK if this can be achieved with a somewhat less ad-hoc approach. I have outlined a proof of concept, please let me know if that would work for you. You could then achieve what you wanted as follow: if my_worker.stealer_ref() == &my_stealer { ... } If this approach suits you, then feel free to modify your PR along those lines (or I can add tests similar to yours and make a PR out of the PoC, just let me know). |
The only objection I have to the POC is that the transmute is shady even with the The |
My understanding of The Rust RFC book also says [...] "without actually being affected by any ABI semantics", which to me suggests that this falls squarely within the safe uses of Now to be clear, I agree that this should not be used and will definitely reconsider if you can point me to discussions that indeed suggest this is an edge case WRT soundness. In the worse case there is the easy way out: storing a The reason I prefer |
I'd strongly prefer this over the transmute.
Fair. My only other major concern is that it returns a reference of a Send/Sync type into the internals of a !Send/!Sync type. While not inherently unsound, it has me suspicious about it's use, even if the core Arc points to the same piece of memory. |
This is in a way why I would argue that storing a On the other hand, there is IMO absolutely nothing wrong in returning a reference to a I guess my point is: using Your reluctance is noted and understood, and as said above I am ready to reconsider if some gotchas are uncovered regarding |
@james7132 I did not get your response on that, should I go on with integrating your tests and merging the PoC? If you are not OK with the proposed course of action then no problem, I would then leave it up to you to close the issue or keep it open (maybe a more consensual way to achieve can still be found, though I ran out of ideas for now). |
Oh completely missed that! Sorry, please do go ahead. |
It's not currently possible to tell whether or not a
Stealer
orWorker
are pointing to the same underlying queue. Could we get a public facing API for this?The text was updated successfully, but these errors were encountered: