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

struct DisjointMut: unsafe impl Send + Sync #1316

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

kkysen
Copy link
Collaborator

@kkysen kkysen commented Jul 14, 2024

Does this reasoning make sense?

In particular, I'm unsure about the provenanceless thing and data races not leading to memory unsafety. Is this worth it to say? Is it worth it to add an unsafe trait Provenanceless to ensure such a thing at a more detailed level? I do think it's an important point that data races won't lead to memory unsafety, though.

@rinon rinon self-assigned this Jul 15, 2024
Base automatically changed from kkysen/mod-disjoint_mut-remove-allow-unused to main July 15, 2024 18:30
src/disjoint_mut.rs Outdated Show resolved Hide resolved
src/disjoint_mut.rs Show resolved Hide resolved
src/disjoint_mut.rs Show resolved Hide resolved
@kkysen kkysen force-pushed the kkysen/struct-DisjointMut-Send-Sync branch from bb9cd1c to ff5f0e7 Compare July 16, 2024 08:54
@kkysen kkysen force-pushed the kkysen/struct-DisjointMut-Send-Sync branch from ff5f0e7 to 7eae462 Compare July 16, 2024 09:25
@kkysen
Copy link
Collaborator Author

kkysen commented Jul 16, 2024

Do we need the T: Send + Sync bounds in the unsafe impl Send + Sync here? Because as is, Rav1dPictureDataComponent is not Send or Sync (which we need it to be) since it contains a ptr: NonNull<u8>. This ptr is not Sync, however, as no synchronization is done.

@rinon
Copy link
Collaborator

rinon commented Jul 16, 2024

I think we need to require it. If that pointer is indeed safe to share we need to mark it as such.

@kkysen
Copy link
Collaborator Author

kkysen commented Jul 16, 2024

I think we need to require it. If that pointer is indeed safe to share we need to mark it as such.

It's not safe, though. That's the problem.

@kkysen
Copy link
Collaborator Author

kkysen commented Jul 16, 2024

Let me think about it some more.

@kkysen kkysen merged commit 5c97ccb into main Jul 18, 2024
27 checks passed
@kkysen kkysen deleted the kkysen/struct-DisjointMut-Send-Sync branch July 18, 2024 01:23
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

Successfully merging this pull request may close these issues.

2 participants