chore: update Lock implementation with latest changes from swift-nio#408
Conversation
Sources/Logging/Locks.swift
Outdated
| InitializeSRWLock(self.mutex) | ||
| #elseif (compiler(<6.1) && !os(WASI)) || (compiler(>=6.1) && _runtime(_multithreaded)) | ||
| #if os(FreeBSD) || os(OpenBSD) | ||
| #elseif os(FreeBSD) || os(OpenBSD) |
There was a problem hiding this comment.
I think we're still missing a call to pthread_mutexattr_destroy in the FreeBSD/OpenBSD branch.
There was a problem hiding this comment.
I have a question. Why is swift-log using swift-nio's deprecated Lock, not the current NIOLock? NIOLock doesn't have such an issue.
There was a problem hiding this comment.
Anyway, I've added the fix for it to apple/swift-nio#3494. Thank you.
There was a problem hiding this comment.
@kkebo Thanks, I updated this PR to match the lock implementation in your PR.
There was a problem hiding this comment.
Why is swift-log using swift-nio's deprecated Lock, not the current NIOLock? NIOLock doesn't have such an issue.
@kkebo I've wondered the same thing. The obvious possible reason I've thought of is that the new lock is named NIOLock, and the repos where Lock is copied don't have anything to do with NIO, so it would be weird for them to have a thing called NIOLock in them.
Honestly, I've wondered why we don't have set up an official Lock and RecursiveLock in Synchronization. This business of copy-pasting a Lock implementation between several repos to avoid inter-dependency isn't the best solution compared to mainstreaming the implementation either in Synchronization or a standalone package.
Anyways, for now, we at least need to keep the implementations in sync. Once this PR merges, I'm planning to synchronize the changes to swift-metrics and swift-distributed-tracing as well (both have copy-pastes of this as well.
I ran |
4751f62 to
4982bc6
Compare
… lock implementation to match the latest implementation in swift-log provided by apple/swift-log#408.
4982bc6 to
a0ceb67
Compare
… lock implementation to match the latest implementation in swift-log provided by apple/swift-log#408.
… lock implementation to match the latest implementation in swift-log provided by apple/swift-log#408.
a0ceb67 to
241c7cc
Compare
#210) Ports changes to `Lock` from `swift-nio` and `swift-log` to `swift-distributed-tracing`. ### Motivation: The copy-paste of `Lock` in `swift-distributed-tracing` should be updated with changes from swift-nio. ### Modifications: - This is a near straight copy of the changes brought from swift-nio to swift-log in apple/swift-log#408. ### Result: `Lock` implementation will have the same or nearly the same implementation as swift-nio (assuming apple/swift-nio#3494 merges). `Lock` will also have the same implementation as swift-log, once apple/swift-log#408 merges.
Ports changes to
Lockfrom swift-nio to swift-log.Motivation:
The copy-paste of
Lockin swift-log should be updated with changes from swift-nio.Modifications:
Rolls back changed made previously for FreeBSD in favor of a consolidated implementation in swift-nio that will be in place once Add partial support for FreeBSD swift-nio#3494 merges. @kkebo Please confirm this works. After both of our PR's merge, swift-log and swift-nio will have the same implementation as far as FreeBSD is concerned.
Brought the following recent changes from swift-nio over to swift-log:
Removed stale
// SRWLOCK does not need to be free'dcomment.Result:
Lockimplementation will have the same implementation as swift-nio (assuming apple/swift-nio#3494 merges).