Skip to content

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

Merged
merged 4 commits into from
Jun 10, 2022

Conversation

Overcot
Copy link
Contributor

@Overcot Overcot commented Jun 8, 2022

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

@tomerd
Copy link
Contributor

tomerd commented Jun 9, 2022

@swift-ci smoke test

@tomerd
Copy link
Contributor

tomerd commented Jun 9, 2022

@abertelrud @neonichu I tend to think maybe we dont need the wrapper at all and just make public extensions on NSLock. wdyt?

import Foundation

/// A simple lock wrapper.
public struct Lock {
Copy link
Contributor

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

Copy link
Contributor Author

@Overcot Overcot Jun 9, 2022

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?

Copy link
Contributor

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

@tomerd tomerd self-assigned this Jun 9, 2022
@Overcot Overcot changed the title Migrate Lock wrapper from TSCBasic to SwiftPM Basics Change from Lock wrapper inside TSCBasic to NSLock Jun 9, 2022
@tomerd
Copy link
Contributor

tomerd commented Jun 9, 2022

@swift-ci smoke test

Copy link
Contributor

@tomerd tomerd left a comment

Choose a reason for hiding this comment

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

lgtm, thank you

@@ -0,0 +1,20 @@
/*
Copy link
Contributor

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
@tomerd
Copy link
Contributor

tomerd commented Jun 10, 2022

@swift-ci smoke test

@tomerd tomerd merged commit 6e798dc into swiftlang:main Jun 10, 2022
@tomerd
Copy link
Contributor

tomerd commented Jun 10, 2022

thank you @Overcot

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.

2 participants