From a3e2da9b34ce232b97b6579d38a8122702fc7d66 Mon Sep 17 00:00:00 2001 From: Anders Ha Date: Tue, 26 May 2020 21:03:01 +0100 Subject: [PATCH] Be more tolerate with error code returned by `pthread_mutex_trylock`. (#788) * Be more tolerate with error code returned by `pthread_mutex_trylock`. * Update changelog. --- CHANGELOG.md | 4 ++++ Sources/Atomic.swift | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 167435600..db091a944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # master *Please add new entries at the top.* +1. Fix a debug assertion in `Lock.try()` that could be raised in earlier OS versions (< iOS 10.0, < macOS 10.12). (#747, #788) + + Specifically, ReactiveSwift now recognizes `EDEADLK` as expected error code from `pthread_mutex_trylock` alongside `0`, `EBUSY` and `EAGAIN`. + # 6.3.0 1. `Property` and `MutableProperty` can now be used as property wrapper. Note that they remain a reference type container, so it may not be appropriate to use them in types requiring value semantics. (#781) ```swift diff --git a/Sources/Atomic.swift b/Sources/Atomic.swift index de92d8e2f..2c843c836 100644 --- a/Sources/Atomic.swift +++ b/Sources/Atomic.swift @@ -178,7 +178,7 @@ internal class Lock { switch status { case 0: return true - case EBUSY, EAGAIN: + case EBUSY, EAGAIN, EDEADLK: return false default: assertionFailure("Unexpected pthread mutex error code: \(status)")