diff options
author | 2018-10-20 09:44:44 -0700 | |
---|---|---|
committer | 2018-10-20 09:44:44 -0700 | |
commit | c6fc07d384fe11ca4dc59111b61557053ed3dbac (patch) | |
tree | 17b98298adea6307e8cb0df56a784af8c7907075 /src/objective-c/GRPCClient/private/GRPCChannel.m | |
parent | 836640dc4a9e8d62fc0e1218e81076a06a3035a9 (diff) |
Relocate global channel pool variables
Diffstat (limited to 'src/objective-c/GRPCClient/private/GRPCChannel.m')
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.m | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 6b5d1fe071..ac4b88f304 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -32,9 +32,12 @@ #import <GRPCClient/GRPCCall+Cronet.h> #import <GRPCClient/GRPCCallOptions.h> -// When all calls of a channel are destroyed, destroy the channel after this much seconds. +/** When all calls of a channel are destroyed, destroy the channel after this much seconds. */ NSTimeInterval kChannelDestroyDelay = 30; +/** Global instance of channel pool. */ +static GRPCChannelPool *gChannelPool; + /** * Time the channel destroy when the channel's calls are unreffed. If there's new call, reset the * timer. @@ -268,11 +271,9 @@ NSTimeInterval kChannelDestroyDelay = 30; return [[GRPCChannel alloc] initWithUnmanagedChannel:unmanaged_channel configuration:config]; } -static dispatch_once_t initChannelPool; -static GRPCChannelPool *gChannelPool; - + (nullable instancetype)channelWithHost:(NSString *)host callOptions:(GRPCCallOptions *)callOptions { + static dispatch_once_t initChannelPool; dispatch_once(&initChannelPool, ^{ gChannelPool = [[GRPCChannelPool alloc] init]; }); |