Skip to content

Commit 8190c33

Browse files
authored
Merge pull request #654 from ReactiveCocoa/anders/locks
Always use error checking pthread mutex.
2 parents 3eecd8c + cdfb621 commit 8190c33

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
*Please add new entries at the top.*
44

5+
1. When unfair locks from libplatform are unavailable, ReactiveSwift now fallbacks to error checking Pthread mutexes instead of the default. Mitigations regarding issues with `pthread_mutex_trylock` have also been applied. (#654, kudos to @andersio)
6+
1. Fix some documentation errors about Carthage usage (#655)
57
1. [CocoaPods] CocoaPods 1.4.0 is the minimum required version. (#651, kudos to @ikesyo)
68
1. `<~` bindings now works with optional left-hand-side operands. (#642, kudos to @andersio and @Ankit-Aggarwal)
79

@@ -13,8 +15,6 @@
1315
nilTarget <~ notifications.map { $0.count }
1416
```
1517

16-
1. Fix some documentation errors about Carthage usage (#655)
17-
1818
# 4.0.0-rc.2
1919

2020
1. Support Swift 4.2 (Xcode 10) (#644, kudos to @ikesyo)

Sources/Atomic.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,7 @@ internal class Lock {
155155
attr.deallocate()
156156
}
157157

158-
// Darwin pthread for 32-bit ARM somehow returns `EAGAIN` when
159-
// using `trylock` on a `PTHREAD_MUTEX_ERRORCHECK` mutex.
160-
#if DEBUG && !arch(arm)
161158
pthread_mutexattr_settype(attr, Int32(recursive ? PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_ERRORCHECK))
162-
#else
163-
pthread_mutexattr_settype(attr, Int32(recursive ? PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_NORMAL))
164-
#endif
165159

166160
let status = pthread_mutex_init(_lock, attr)
167161
assert(status == 0, "Unexpected pthread mutex error code: \(status)")
@@ -184,7 +178,7 @@ internal class Lock {
184178
switch status {
185179
case 0:
186180
return true
187-
case EBUSY:
181+
case EBUSY, EAGAIN:
188182
return false
189183
default:
190184
assertionFailure("Unexpected pthread mutex error code: \(status)")

0 commit comments

Comments
 (0)