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

Adopt Sendable in EventLoop.swift #2101

Merged
merged 10 commits into from
May 30, 2022
Merged

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented May 10, 2022

No description provided.

@Lukasa Lukasa added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label May 10, 2022
@@ -19,15 +19,28 @@ import Dispatch
///
/// A `Scheduled` allows the user to either `cancel()` the execution of the scheduled task (if possible) or obtain a reference to the `EventLoopFuture` that
/// will be notified once the execution is complete.
public struct Scheduled<T> {
public struct Scheduled<T>: NIOSendable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be preconcurrency? We can only be Sendable where the generic type is Sendable.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question and I think the question boils down to if EventLoopPromise should be unconditionality Sendable or not.

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 have made it only conditionally Sendable as EventLoopPromise should have been only conditionally Sendable as well.

Sources/NIOCore/EventLoop.swift Outdated Show resolved Hide resolved
#endif

#if swift(>=5.6)
@preconcurrency
Copy link
Contributor

Choose a reason for hiding this comment

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

Does @preconcurrency do anything for us if this is internal only?

Copy link
Member Author

Choose a reason for hiding this comment

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

it isn't necessary here, removed.

/* private but usableFromInline */ @usableFromInline let _cancellationTask: () -> Void
#endif

#if swift(>=5.6)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be 5.6 or 5.7?

Copy link
Member Author

Choose a reason for hiding this comment

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

Update all to 5.7

Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Nice stuff, thanks @dnadoba.

@Lukasa
Copy link
Contributor

Lukasa commented May 30, 2022

API breakage change is expected.

@Lukasa Lukasa merged commit 94969e7 into apple:main May 30, 2022
@dnadoba dnadoba deleted the dn-sendable-event-loop branch May 30, 2022 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants