-
Notifications
You must be signed in to change notification settings - Fork 480
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
Request: Send + Sync version of a Handle #207
Comments
Oh and if you want to put something in a |
Can't you use a |
You can, but that has performance implications - every single time you want to use the GC, you have to |
In #71, we discussed that |
…sbeam-rs#207 Some rustc arguments like --out-dir, -L, and --extern contain absolute paths which make building the same crate (from crates.io) in different projects unable to get cache hits despite being otherwise the same. This patch omits those arguments from the hash calculation which makes sccache much more useful for local development. For additional safety we add the cwd to the hash key, since that winds up in the rlib and otherwise this patch could result in some compiles returning invalid results from cache.
For data structures that want to be concurrent and only expose handles, the fact that crossbeam
Handle
s are neitherSend
norSync
is an issue. For example, in elfmalloc, we'd like to have allocator handles which are, at the very least,Sync
so that you can share them between threads by callingclone
from a new thread, but the fact thatHandle
s are notSync
has prevented us from doing that without resorting to unsafe code.The problem comes down to the fact that
Handle
s use immutable methods in thread-unsafe ways. You could imagine a handle where thepin
andis_pinned
methods were mutable, leavingclone
as the only immutable method, which would be implemented asself.collector().register()
. In fact, in order to sidestep this issue, that's exactly what I'm doing right now for elfmalloc:It would also be nice if such a handle could be
Send
, although I'm not sure how that would be done with the currentLocal
-based design.The text was updated successfully, but these errors were encountered: