Skip to content

Add NSLock.withLock(_:) method #4736

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 1 commit into from
Jan 4, 2024
Merged

Add NSLock.withLock(_:) method #4736

merged 1 commit into from
Jan 4, 2024

Conversation

fumoboy007
Copy link
Contributor

Fixes #4735.

Xcode 14 introduced the NSLocking.withLock(_:) method to the Darwin implementation of Foundation. This commit adds the new method to the open-source implementation.

(Note: The documentation incorrectly specifies the availability of the method as iOS 16+, etc. but it is actually available on all OS versions because it is marked @_alwaysEmitIntoClient. The documentation bug is tracked by FB11968310.)

I copied the implementation from Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-ios.swiftinterface.

@parkera
Copy link
Contributor

parkera commented Apr 23, 2023

@swift-ci test

@fumoboy007
Copy link
Contributor Author

fumoboy007 commented Apr 23, 2023

@parkera

  • The macOS test pipeline failed before the tests were run?
  • The Windows test pipeline shows TestFoundation.TestNSLock-test_withLock … Passed despite resulting in “Build finished. No test results found”.

@parkera
Copy link
Contributor

parkera commented Apr 24, 2023

@swift-ci test

@fumoboy007
Copy link
Contributor Author

All three pipelines failed with different errors. 😳

@parkera
Copy link
Contributor

parkera commented Apr 25, 2023

@swift-ci test

@fumoboy007
Copy link
Contributor Author

@parkera Shall we do @swift-ci test macOS this time? 😅

@fumoboy007
Copy link
Contributor Author

@parkera Is the automated test infrastructure behaving better these days?

@parkera
Copy link
Contributor

parkera commented Aug 21, 2023

@swift-ci test

@fumoboy007
Copy link
Contributor Author

😢

Fixes swiftlang#4735.

Xcode 14 introduced the `NSLocking.withLock(_:)` method to the Darwin implementation of Foundation. This commit adds the new method to the open-source implementation.

(Note: The [documentation](https://developer.apple.com/documentation/foundation/nslocking/4059821-withlock) incorrectly specifies the availability of the method as iOS 16+, etc. but it is actually available on all OS versions because it is marked [`@_alwaysEmitIntoClient`](https://github.com/apple/swift/blob/main/docs/ReferenceGuides/UnderscoredAttributes.md#_alwaysemitintoclient). The documentation bug is tracked by [FB11968310](https://feedbackassistant.apple.com/feedback/11968310).)

I copied the implementation from `Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-ios.swiftinterface`.
@parkera
Copy link
Contributor

parkera commented Aug 28, 2023

@swift-ci test

@fumoboy007
Copy link
Contributor Author

I hope there’s someone working full-time on making the automated test infrastructure more reliable. 😕

@fumoboy007
Copy link
Contributor Author

The macOS issue seems to be

CMake Error at CMakeLists.txt:11 (project):
  The CMAKE_C_COMPILER:

    /Users/ec2-user/jenkins/workspace/swift-corelibs-foundation-PR-macOS/branch-main/build/Ninja-ReleaseAssert/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.

The Windows issue is

Expected — Waiting for status to be reported

@fumoboy007
Copy link
Contributor Author

😢

@parkera
Copy link
Contributor

parkera commented Dec 1, 2023

@swift-ci test

@fumoboy007
Copy link
Contributor Author

All checks passed!

@fumoboy007
Copy link
Contributor Author

Happy New Year! Merge, please. 😭

@parkera parkera merged commit aed2252 into swiftlang:main Jan 4, 2024
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.

NSLocking missing withLock(_:) method
2 participants