Skip to content

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EmbeddedEventLoop/Channel violates Sendable: Store the current thread in init() and then assert that we're on that thread

2 participants