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

Possibly add a T: Send + Sync requirement to the Send and Sync impls #67

Closed
indiv0 opened this issue Feb 24, 2017 · 0 comments
Closed

Comments

@indiv0
Copy link
Owner

indiv0 commented Feb 24, 2017

Per dbaupp's comments here, it might make sense to make the AtomicLazyCell<T>: Sync impl T: Sync + Send (possibly the Send impl too?).

@carllerche seeing as you initially wrote the code, and this is a (possibly?) breaking change, thoughts?

@indiv0 indiv0 changed the title Possible add a T: Send + Sync requirement to the Send and Sync impls Possibley add a T: Send + Sync requirement to the Send and Sync impls Feb 24, 2017
@indiv0 indiv0 changed the title Possibley add a T: Send + Sync requirement to the Send and Sync impls Possibly add a T: Send + Sync requirement to the Send and Sync impls Feb 24, 2017
indiv0 added a commit that referenced this issue Nov 25, 2017
Add a `T: Send` to the existing `T: Sync` restriction on the `AtomicLazyCell`
`Sync` impl.
This is necessary because filling an `AtomicLazyCell` only requires a reference
to the cell (i.e. `&AtomicLazyCell`), which means that an empty
`&AtomicLazyCell<T>` can be passed to a child thread (provided that
`AtomicLazyCell<T>: Sync` is satisfied), and filled on the child thread.
The filled value would then be on the stack of, and destroyed by, the
parent thread.

Kudos to dbaupp on Reddit for this recommendation.

Closes #67.
BREAKING CHANGE: the `AtomicLazyCell` `Sync` impl now has a `<T: Sync + Send>`
    constraint instead of a `<T: Sync>` constraint.

    To migrate your code, remove any `AtomicLazyCell<T>` instances where
    `<T: Sync + !Send>`, as this usecase is no longer supported.
@indiv0 indiv0 closed this as completed in 668bb2f Nov 25, 2017
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

1 participant