Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

EmbeddedEventLoop/Channel: check correct thread #2951

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Conversation

weissi
Copy link
Member

@weissi weissi commented Oct 24, 2024

Motivation:

EmbeddedChannel & EmbeddedEventLoop currently violate Sendable. They should store the current thread in init and then implement inEventLoop and other functions with a check that the current thread is correct.
Since NIO 1.0 Embedded* were always documented to not be thread-safe but we should finally police this.

Modifications:

Result:

@weissi weissi added the 🔨 semver/patch No public API change. label Oct 24, 2024
@weissi weissi force-pushed the jw-2949 branch 2 times, most recently from 71cab13 to 03e324d Compare October 24, 2024 16:38
}
#else
func isCorrectThread() -> Bool {
true // let's be conservative
Copy link
Contributor

Choose a reason for hiding this comment

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

By "conservative" this means "keep working"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I did actually want to reword this -- and forgot.

@Lukasa Lukasa merged commit 1ff5fd5 into apple:main Oct 25, 2024
42 of 43 checks passed
@weissi weissi deleted the jw-2949 branch October 25, 2024 09:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
2 participants