Skip to content

Conversation

iCharlesHu
Copy link
Contributor

@iCharlesHu iCharlesHu commented Aug 23, 2025

Introduce runOnBackgroundThread() to run closures on a background thread without blocking the Swift Concurrency thread pool.

On Darwin, runOnBackgroundThread() uses DispatchQueue; on Linux and Windows, it uses a single thread in the work loop.

Resolves: #85

@iCharlesHu iCharlesHu force-pushed the charles/async-spawn branch from fd53084 to 4d58af5 Compare August 28, 2025 02:49
Introduce runOnBackgroundThread() to run closures on a background thread without blocking the Swift Concurrency thread pool
Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

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

testWriteToClosedPipe is failing - I think this is another one of those cases that is fundamentally impossible to test, since the fd could be pointing to anything by the time you try to write to it.

@iCharlesHu
Copy link
Contributor Author

testWriteToClosedPipe is failing - I think this is another one of those cases that is fundamentally impossible to test, since the fd could be pointing to anything by the time you try to write to it.

Agreed. I'll disable this test

…we can't safely write to / read from a closed fd
@iCharlesHu iCharlesHu merged commit 6eb91f6 into swiftlang:main Sep 4, 2025
39 checks passed
@iCharlesHu iCharlesHu deleted the charles/async-spawn branch September 4, 2025 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

self.spawn is a blocking function but is run on async threads

3 participants