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

Strict concurrency for SelectableEventLoop & MTELG #3084

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Jan 24, 2025

Motivation

SelectableEventLoop and MTEL are our major entry points for execution. These need to be strict concurrency clean. Unfortunately, changes in one tend to ripple into the other, so we need to tackle both at once.

Modifications

  • A few closures get annotated @sendable
  • Add a NIOLockedValueBox to convince the compiler that this use is safe.
  • Make a few types explicitly not Sendable

Result

No concurrency warnings in MTELG and SelectableEventLoop.

Motivation

SelectableEventLoop and MTEL are our major entry points for
execution. These need to be strict concurrency clean. Unfortunately,
changes in one tend to ripple into the other, so we need to tackle
both at once.

Ideally we would not use `@unchecked Sendable` for
SelectableEventLoop. With NIOLoopBound and our other tools, I
think we have a real shot at getting the compiler to prove much
more of the correctness of this type. However, right now that's
not prudent: we'd like to unblock the rest of the ecosystem. So
we'll tolerate an `@unchecked Sendable` for now, with a plan to
revisit.

Modifications

- SelectableEventLoop is @unchecked Sendable
- A few closures get annotated @sendable
- Add a NIOLockedValueBox to convince the compiler that this use
    is safe.
- Make a few types explicitly not Sendable

Result

No concurrency warnings in MTELG and SelectableEventLoop.
@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Jan 24, 2025
@Lukasa Lukasa enabled auto-merge (squash) January 24, 2025 11:18
@Lukasa Lukasa merged commit 5ce7fde into apple:main Jan 24, 2025
33 of 35 checks passed
@Lukasa Lukasa deleted the cb-unchecked-sendable-for-sel branch January 24, 2025 12:17
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.

2 participants