-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix concurrency warnings in AsyncProcess #9430
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
base: main
Are you sure you want to change the base?
Fix concurrency warnings in AsyncProcess #9430
Conversation
Squashes the warnings in AsyncProcess by adjusting required callbacks to be `@Sendable`, marking lock protected state as `nonisolated(unsafe)` and using a `ThreadSafeBox` to capture the process result.
|
@swift-ci test windows |
|
@swift-ci test Linux |
|
@swift-ci test windows |
|
@swift-ci test macos |
| package typealias LoggingHandler = @Sendable (String) -> Void | ||
|
|
||
| private static var _loggingHandler: LoggingHandler? | ||
| nonisolated(unsafe) private static var _loggingHandler: LoggingHandler? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of nonisolated(unsafe) can you use ThreadSafeBox?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I've also updated validatedExecutablesMap to use ThreadSafeKeyValueStore.
|
@swift-ci test |
|
@swift-ci test windows |
3 similar comments
|
@swift-ci test windows |
|
@swift-ci test windows |
|
@swift-ci test windows |
Squashes the warnings in AsyncProcess by adjusting required callbacks to be
@Sendable, marking lock protected state asnonisolated(unsafe)and using aThreadSafeBoxto capture the process result. Fixes up warnings in AsyncProcessTests as well.