diff options
author | 2017-12-06 22:02:08 -0800 | |
---|---|---|
committer | 2017-12-06 22:02:08 -0800 | |
commit | fc38142db69cd8c95f3c55a296b4e73b04c720c3 (patch) | |
tree | 8287e97154a1edcd764585623aa6cda08439159b /src/objective-c | |
parent | a4839e7aea1bd1ae057584a5cdf125541ef11016 (diff) | |
parent | e52772451a7bbf4f3f7b72cfc369781fd74a6930 (diff) |
Merge commit 'b0bad8f^' into fix-stream-compression-config-interface
Diffstat (limited to 'src/objective-c')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.m | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index d6c3a3c165..b5ab611848 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -112,10 +112,13 @@ static NSString * const kBearerPrefix = @"Bearer "; @synthesize state = _state; -// TODO(jcanizales): If grpc_init is idempotent, this should be changed from load to initialize. -+ (void)load { - grpc_init(); - callFlags = [NSMutableDictionary dictionary]; ++ (void)initialize { + // Guarantees the code in {} block is invoked only once. See ref at: + // https://developer.apple.com/documentation/objectivec/nsobject/1418639-initialize?language=objc + if (self == [GRPCCall self]) { + grpc_init(); + callFlags = [NSMutableDictionary dictionary]; + } } + (void)setCallSafety:(GRPCCallSafety)callSafety host:(NSString *)host path:(NSString *)path { |