摘要:
1 前言 协程的 select 是一种用于异步操作的选择器,它允许同时等待多个挂起函数的结果,并在其中一个完成时执行相应的操作。 能够被 select 的事件都是 SelectClause,在 select.kt 中有定义,如下。 public interface SelectBuilder 阅读全文

摘要:
1 前言 Channel 是一个并发安全的阻塞队列,可以通过 send 函数往队列中塞入数据,通过 receive 函数从队列中取出数据。 当队列被塞满时,send 函数将被挂起,直到队列有空闲缓存;当队列空闲时,receive 函数将被挂起,直到队列中有新数据存入。 Channel 中 阅读全文
