-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Change from Lock wrapper inside TSCBasic to NSLock #5575
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
Conversation
@swift-ci smoke test |
@abertelrud @neonichu I tend to think maybe we dont need the wrapper at all and just make public extensions on NSLock. wdyt? |
Sources/Basics/Lock.swift
Outdated
import Foundation | ||
|
||
/// A simple lock wrapper. | ||
public struct Lock { |
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.
@Overcot wdyt about ditching the wrapper approach and instead just declare an extension on NSLock
with the withLock
function? then we can update the callosities to use NSLock
instead of LocK
from TSC
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.
Yeah, sure. If everyone agrees, I would it. This seems like a better approach. Btw - is the NSLock available on Windows?
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.
Btw - is the NSLock available on Windows?
I believe so
@swift-ci smoke test |
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.
lgtm, thank you
Sources/Basics/Lock.swift
Outdated
@@ -0,0 +1,20 @@ | |||
/* |
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.
one small change: rename the file to NSLock+Extensions.swift
and add it to the CMakeLists.txt
Add it to CMakeLists
@swift-ci smoke test |
thank you @Overcot |
Motivation:
As mentioned by @tomerd in swiftlang/swift-tools-support-core#327 (comment) in order to move Process handling inside SPM there is a need to move Lock wrapper inside SPM Basics as well
Modifications:
Basically copy pasted Lock implementation in TSCBasic to SPM Basic. Also needed to explicitly set module in order to solve conflicts when using Lock
Result:
After the change i will continue to migrate bits that are required by process migration