-
Notifications
You must be signed in to change notification settings - Fork 2
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
Multi-threading possible? #48
Comments
Good question. Multi-threaded Rust is still not supported, no. struct S {
inner: Rc<String>
}
impl Drop for S {
fn drop(&mut self) {
// deref a non-send, non-sync field. This must be done from the same thread.
println("Hello {}", self.inner);
}
}
fn main() {
let rc = Rc::new(String::from("Hello World"));
let s = Gc::new(Rc::clone(rc));
// 1. gc collection happens, `s` is finalized off-thread, calling S::drop.
// 2. The drop impl deref's a `Rc<String>` off the main thread. This is UB.
} This example is somewhat contrived, but it's there to illustrate that the For multi-threading support, we still need a way to intercept |
In the README.md of the repo, it says that the lib only supports single-threaded applications, but given that the inner type of a Gc pointer now requires
Send
andSync
, I wanted to check if this was still the case.The text was updated successfully, but these errors were encountered: