Skip to content

Commit 5cc8510

Browse files
committed
Always use error checking pthread mutex.
1 parent 7503872 commit 5cc8510

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

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)