也可以用非阻塞方式调用send方法。
非阻塞版本相对于基于锁的版本有几个性能优势。
The nonblocking version has several performance advantages over the lock-based version.
lock函数必须立即进行检查并返回(非阻塞方式)。
The lock function must immediately check and return (non-blocking).
为了使通道成为非阻塞的,我们在通道上调用 configureBlockingMethod(false) ,如下所示
To make the channel nonblocking, we call configureBlockingMethod(false) on the channel, as shown here
为了使通道成为非阻塞的,我们在通道上调用 configureBlockingMethod(false) ,如下所示
To make the channel nonblocking, we call configureBlockingMethod(false) on the channel, as shown here
应用推荐