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

Make Windows and Web handles !Send and !Sync #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

madsmtm
Copy link
Member

@madsmtm madsmtm commented Oct 13, 2023

Follow-up to #152 to consider documenting our decision on main thread safety, and making some handles !Send and !Sync.

@madsmtm madsmtm added documentation Improvements or additions to documentation enhancement New feature or request labels Oct 13, 2023
@notgull
Copy link
Member

notgull commented Oct 14, 2023

Making these handles un-Send would be a breaking change, so we might not want to do this.

Base automatically changed from test-auto-traits to master October 14, 2023 08:17
@madsmtm
Copy link
Member Author

madsmtm commented Oct 14, 2023

might not want to do this

Yet, at least ;)

@@ -33,6 +34,7 @@ pub struct WebWindowHandle {
///
/// [data attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*
pub id: u32,
_marker: PhantomData<*const ()>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what to think of this, the ID here is not a pointer, but it might be misleading for consumers who think that they are on the main thread if they got this variant.

Is there any previous discussion on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was also wondering if there are any plans to remove this type completely, now that we have the WebCanvasWindowHandle and WebOffscreenCanvasWindowHandle types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plans to remove this type completely

Moved to #157.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what to think of this, the ID here is not a pointer, but it might be misleading for consumers who think that they are on the main thread if they got this variant.

Well, that's the same as what I've documented on e.g. AppKitWindowHandle, but I'm beginning to see that that may not be the best approach (hence why this PR isn't merged yet).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some more thinking I'm now in favor of making this !Send.

@madsmtm madsmtm marked this pull request as ready for review March 21, 2024 18:46
@madsmtm madsmtm changed the title Make more handles !Send and !Sync, and document main thread safety Make Windows and Web handles !Send and !Sync Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants