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

Unsafe impls #23

Closed
Ericson2314 opened this issue Apr 18, 2016 · 3 comments
Closed

Unsafe impls #23

Ericson2314 opened this issue Apr 18, 2016 · 3 comments

Comments

@Ericson2314
Copy link
Contributor

While working on Once, I noticed that our unsafe Send and Sync impls are different from std---I am not sure why or whether its sound. [I ended up going with the RwLock ones for Once, since both give access to a &T to potentially multiple threads.]

@mvdnes
Copy link
Owner

mvdnes commented Apr 19, 2016

At one point, I thought I understood how Send and Sync work, but the more I read the less sure I am.
I do not really know why you would need the Send bound for Mutex to be Sync for example.

Also, I think Mutex is already Send when T: Send, but that needs to be tested.

Any thoughts on this matter would be welcome.

@Ericson2314
Copy link
Contributor Author

I'm a bit rusty too. Last I heard T: Sync means its safe to share &T across threads, and Sync => Send.

I'd just make them match their std equivalents as I can't think of any reason why differences in implementation would matter here.

@mvdnes
Copy link
Owner

mvdnes commented Apr 19, 2016

Seems like a reasonable thing to do, yes

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

No branches or pull requests

2 participants