Specify thread-safety of grpc-created channels

pull/15773/head
Nathaniel Manista 7 years ago
parent a726484455
commit a5530e9e36
  1. 8
      src/python/grpcio/grpc/__init__.py

@ -1572,13 +1572,15 @@ def channel_ready_future(channel):
def insecure_channel(target, options=None): def insecure_channel(target, options=None):
"""Creates an insecure Channel to a server. """Creates an insecure Channel to a server.
The returned Channel is thread-safe.
Args: Args:
target: The server address target: The server address
options: An optional list of key-value pairs (channel args options: An optional list of key-value pairs (channel args
in gRPC Core runtime) to configure the channel. in gRPC Core runtime) to configure the channel.
Returns: Returns:
A Channel object. A Channel.
""" """
from grpc import _channel # pylint: disable=cyclic-import from grpc import _channel # pylint: disable=cyclic-import
return _channel.Channel(target, () if options is None else options, None) return _channel.Channel(target, () if options is None else options, None)
@ -1587,6 +1589,8 @@ def insecure_channel(target, options=None):
def secure_channel(target, credentials, options=None): def secure_channel(target, credentials, options=None):
"""Creates a secure Channel to a server. """Creates a secure Channel to a server.
The returned Channel is thread-safe.
Args: Args:
target: The server address. target: The server address.
credentials: A ChannelCredentials instance. credentials: A ChannelCredentials instance.
@ -1594,7 +1598,7 @@ def secure_channel(target, credentials, options=None):
in gRPC Core runtime) to configure the channel. in gRPC Core runtime) to configure the channel.
Returns: Returns:
A Channel object. A Channel.
""" """
from grpc import _channel # pylint: disable=cyclic-import from grpc import _channel # pylint: disable=cyclic-import
return _channel.Channel(target, () if options is None else options, return _channel.Channel(target, () if options is None else options,

Loading…
Cancel
Save