Skip to content

Conversation

@Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Feb 3, 2025

Motivation:

We're continuing out Strict Concurrency journey, making sure users of NIO can write data-race-free code.

Modifications:

  • Added some missing Sendable annotations in NIOAsyncSequenceProducer

  • Made BufferedStream unconditionally Sendable, and required its Element type to also be Sendable.

    The prior constraint wasn't actually correct. We always
    behaved as though the element types were Sendable, by passing
    them into continuations. This cleans things up.

  • Made AnyAsyncSequence Sendable, which it needs to be.

  • Made BufferedOrAnyStream Sendable, which it needs to be.

  • Made DirectoryEntries explicitly Sendable, which it was.

  • Made DirectoryEntries.Batched explicitly Sendable.

Result:

Better concurrency-safety

Motivation:

We're continuing out Strict Concurrency journey, making sure users
of NIO can write data-race-free code.

Modifications:

- Added some missing Sendable annotations in
    NIOAsyncSequenceProducer
- Made BufferedStream unconditionally Sendable, and required its
    Element type to also be Sendable.

    The prior constraint wasn't actually correct. We always
    behaved as though the element types were Sendable, by passing
    them into continuations. This cleans things up.
- Made AnyAsyncSequence Sendable, which it needs to be.
- Made BufferedOrAnyStream Sendable, which it needs to be.
- Made DirectoryEntries explicitly Sendable, which it was.
- Made DirectoryEntries.Batched explicitly Sendable.

Result:

Better concurrency-safety
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Feb 3, 2025
@Lukasa
Copy link
Contributor Author

Lukasa commented Feb 3, 2025

Merging over the API breakage.

@Lukasa Lukasa merged commit 08b3b4f into apple:main Feb 3, 2025
31 of 35 checks passed
@Lukasa Lukasa deleted the cb-strict-concurrency-nio-filesystem branch February 3, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants