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

Clean up Sendability in Thread and ThreadPool #3081

Merged
merged 3 commits into from
Jan 23, 2025
Merged

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Jan 23, 2025

Motivation

Next on my journey of discovery is NIOThread and NIOThreadPool. These are basically fine, but they need some Sendability annotations and a bit of a cleanup.

Modifications

Add some Sendability
Clean up some shutdown logic to avoid semaphores.

Result

Another step forward to a strict-concurrency safe world.

Motivation

Next on my journey of discovery is NIOThread and NIOThreadPool.
These are basically fine, but they need some Sendability annotations
and a bit of a cleanup.

Modifications

Add some Sendability
Clean up some shutdown logic to avoid semaphores.

Result

Another step forward to a strict-concurrency safe world.
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Jan 23, 2025
@@ -74,8 +74,27 @@ private func sysPthread_create(

typealias ThreadOpsSystem = ThreadOpsPosix

struct PthreadWrapper: @unchecked Sendable {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Can't we use our existing UnsafeTransfer for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, but in this case I wanted a special-case wrapper that we can see, and aim to remove when it's no longer needed.

@Lukasa
Copy link
Contributor Author

Lukasa commented Jan 23, 2025

The API breakages are expected.

@Lukasa Lukasa merged commit e40cbce into apple:main Jan 23, 2025
32 of 35 checks passed
@Lukasa Lukasa deleted the cb-nio-thread branch January 23, 2025 15:46
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