diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2015-12-21 00:31:04 -0800 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2015-12-21 00:34:19 -0800 |
commit | d21780841734326d8a7653710f4f23b5366c4447 (patch) | |
tree | 25df44708c81059a3e1c7025e12b734cc80ee3f4 /objectivec/GPBMessage.m | |
parent | 1e2fece3e01b8e079b4f6930306377a9332a2ddb (diff) | |
parent | b27f2893b2a118b4e3bfcd23d32114dbdd4e6d9b (diff) | |
download | protobuf-d21780841734326d8a7653710f4f23b5366c4447.tar.gz protobuf-d21780841734326d8a7653710f4f23b5366c4447.tar.bz2 protobuf-d21780841734326d8a7653710f4f23b5366c4447.zip |
Merge branch master into v3.0.0-beta-2
Diffstat (limited to 'objectivec/GPBMessage.m')
-rw-r--r-- | objectivec/GPBMessage.m | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/objectivec/GPBMessage.m b/objectivec/GPBMessage.m index d9080c3f..208cfe4e 100644 --- a/objectivec/GPBMessage.m +++ b/objectivec/GPBMessage.m @@ -568,13 +568,13 @@ static id GetArrayIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) { id array = GPBGetObjectIvarWithFieldNoAutocreate(self, field); if (!array) { // Check again after getting the lock. - OSSpinLockLock(&self->readOnlyMutex_); + dispatch_semaphore_wait(self->readOnlySemaphore_, DISPATCH_TIME_FOREVER); array = GPBGetObjectIvarWithFieldNoAutocreate(self, field); if (!array) { array = CreateArrayForField(field, self); GPBSetAutocreatedRetainedObjectIvarWithField(self, field, array); } - OSSpinLockUnlock(&self->readOnlyMutex_); + dispatch_semaphore_signal(self->readOnlySemaphore_); } return array; } @@ -598,13 +598,13 @@ static id GetMapIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) { id dict = GPBGetObjectIvarWithFieldNoAutocreate(self, field); if (!dict) { // Check again after getting the lock. - OSSpinLockLock(&self->readOnlyMutex_); + dispatch_semaphore_wait(self->readOnlySemaphore_, DISPATCH_TIME_FOREVER); dict = GPBGetObjectIvarWithFieldNoAutocreate(self, field); if (!dict) { dict = CreateMapForField(field, self); GPBSetAutocreatedRetainedObjectIvarWithField(self, field, dict); } - OSSpinLockUnlock(&self->readOnlyMutex_); + dispatch_semaphore_signal(self->readOnlySemaphore_); } return dict; } @@ -810,7 +810,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) { messageStorage_ = (GPBMessage_StoragePtr)( ((uint8_t *)self) + class_getInstanceSize([self class])); - readOnlyMutex_ = OS_SPINLOCK_INIT; + readOnlySemaphore_ = dispatch_semaphore_create(1); } return self; @@ -1723,7 +1723,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) { } // Check for an autocreated value. - OSSpinLockLock(&readOnlyMutex_); + dispatch_semaphore_wait(readOnlySemaphore_, DISPATCH_TIME_FOREVER); value = [autocreatedExtensionMap_ objectForKey:extension]; if (!value) { // Auto create the message extensions to match normal fields. @@ -1740,7 +1740,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) { [value release]; } - OSSpinLockUnlock(&readOnlyMutex_); + dispatch_semaphore_signal(readOnlySemaphore_); return value; } |