From bd41a39f693d8307d407e42b634b315e075b6c8f Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 21 Mar 2016 11:11:14 -0400 Subject: Only create the readonlySemaphore on demand. This will lower the amount of dispatch_semaphores created per Message when the full object tree isn't walked in a way that would require them to be created. Uses a dispatch_once_t for one time init of the dispatch_semaphore. --- objectivec/GPBUtilities.m | 1 + 1 file changed, 1 insertion(+) (limited to 'objectivec/GPBUtilities.m') diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m index 3e9d11c0..447c749a 100644 --- a/objectivec/GPBUtilities.m +++ b/objectivec/GPBUtilities.m @@ -412,6 +412,7 @@ id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) { return field.defaultValue.valueMessage; } + GPBPrepareReadOnlySemaphore(self); dispatch_semaphore_wait(self->readOnlySemaphore_, DISPATCH_TIME_FOREVER); GPBMessage *result = GPBGetObjectIvarWithFieldNoAutocreate(self, field); if (!result) { -- cgit v1.2.3