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

Avoid using vendored lock in BroadcastAsyncSequence #2108

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Nov 7, 2024

Motivation:

ManagedBuffer is explicitly not 'Sendable' on Swift nightly builds. As a result, our Lock type stops being 'Sendable'. This is only used by the 'BroadcastAsyncSequence'.

Modifications:

  • Modify 'BroadcastAsyncSequence' to use 'Mutex'. One downside to this approach is that when a subscribe wants to consume an element and there's no element available, the lock must be released and then re-acquired once a continuation has been created.
  • Remove our lock, and update NOTICES.txt to reflect the fact we no longer use a copy of NIOs lock.

Result:

  • Less code
  • CI passes

Motivation:

ManagedBuffer is explicitly not 'Sendable' on Swift nightly builds. As a
result, our Lock type stops being 'Sendable'. This is only used by the
'BroadcastAsyncSequence'.

Modifications:

- Modify 'BroadcastAsyncSequence' to use 'Mutex'. One downside to this
  approach is that when a subscribe wants to consume an element and
  there's no element available, the lock must be released and then
  re-acquired once a continuation has been created.
- Remove our lock, and update NOTICES.txt to reflect the fact we no
  longer use a copy of NIOs lock.

Result:

- Less code
- CI passes
@glbrntt glbrntt requested a review from rnro November 7, 2024 14:01
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Nov 7, 2024
@glbrntt glbrntt merged commit 61cc2d1 into grpc:main Nov 8, 2024
45 of 46 checks passed
@glbrntt glbrntt deleted the v2/use-mutex branch November 8, 2024 11:27
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