diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2015-12-17 14:35:44 -0500 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2015-12-17 16:05:50 -0500 |
commit | d6590d653415c0bfacf97e7f768dd3c994cb8d26 (patch) | |
tree | 8c0f6f98eb867d520e95d30d32a6d0e4fe55906c /objectivec/GPBMessage_PackagePrivate.h | |
parent | afbc89a263d57bb2e36ce5f07b979c739bb2e8cd (diff) | |
download | protobuf-d6590d653415c0bfacf97e7f768dd3c994cb8d26.tar.gz protobuf-d6590d653415c0bfacf97e7f768dd3c994cb8d26.tar.bz2 protobuf-d6590d653415c0bfacf97e7f768dd3c994cb8d26.zip |
Drop all use of OSSpinLock
Apple engineers have pointed out that OSSpinLocks are vulnerable to live locking
on iOS in cases of priority inversion:
. http://mjtsai.com/blog/2015/12/16/osspinlock-is-unsafe/
. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000372.html
- Use a dispatch_semaphore_t within the extension registry.
- Use a dispatch_semaphore_t for protecting autocreation within messages.
- Drop the custom/internal GPBString class since we don't have really good
numbers to judge the locking replacements and it isn't required. We can
always bring it back with real data in the future.
Diffstat (limited to 'objectivec/GPBMessage_PackagePrivate.h')
-rw-r--r-- | objectivec/GPBMessage_PackagePrivate.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/objectivec/GPBMessage_PackagePrivate.h b/objectivec/GPBMessage_PackagePrivate.h index d4c3501a..b7e24fc9 100644 --- a/objectivec/GPBMessage_PackagePrivate.h +++ b/objectivec/GPBMessage_PackagePrivate.h @@ -62,7 +62,12 @@ typedef struct GPBMessage_Storage *GPBMessage_StoragePtr; // by *read* operations such as getters (autocreation of message fields and // message extensions, not setting of values). Used to guarantee thread safety // for concurrent reads on the message. - OSSpinLock readOnlyMutex_; + // NOTE: OSSpinLock may seem like a good fit here but Apple engineers have + // pointed out that they are vulnerable to live locking on iOS in cases of + // priority inversion: + // http://mjtsai.com/blog/2015/12/16/osspinlock-is-unsafe/ + // https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000372.html + dispatch_semaphore_t readOnlySemaphore_; } // Gets an extension value without autocreating the result if not found. (i.e. |