aboutsummaryrefslogtreecommitdiff
path: root/objectivec/google/protobuf/Struct.pbobjc.m
diff options
context:
space:
mode:
Diffstat (limited to 'objectivec/google/protobuf/Struct.pbobjc.m')
-rw-r--r--objectivec/google/protobuf/Struct.pbobjc.m5
1 files changed, 3 insertions, 2 deletions
diff --git a/objectivec/google/protobuf/Struct.pbobjc.m b/objectivec/google/protobuf/Struct.pbobjc.m
index f36ec582..dff2f844 100644
--- a/objectivec/google/protobuf/Struct.pbobjc.m
+++ b/objectivec/google/protobuf/Struct.pbobjc.m
@@ -51,7 +51,7 @@ static GPBFileDescriptor *GPBStructRoot_FileDescriptor(void) {
#pragma mark - Enum GPBNullValue
GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
- static GPBEnumDescriptor *descriptor = NULL;
+ static _Atomic(GPBEnumDescriptor*) descriptor = NULL;
if (!descriptor) {
static const char *valueNames =
"NullValue\000";
@@ -64,7 +64,8 @@ GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBNullValue_IsValidValue];
- if (!OSAtomicCompareAndSwapPtrBarrier(nil, worker, (void * volatile *)&descriptor)) {
+ GPBEnumDescriptor *expected = nil;
+ if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
}
}