Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Yan0613/MIT6.824 into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan0613 committed Oct 22, 2023
2 parents b38cde2 + 85928fc commit 4d2d1e0
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,6 @@ Tips: Go语言的通道的用法
close(ch)
```

4. **通道的选择语句:**
通道经常与 `select` 语句一起使用,允许在多个通道之间进行非阻塞的选择。这对于处理多路数据流很有用。

```go
select {
case msg1 := <-ch1:
// 处理从 ch1 接收到的数据
case msg2 := <-ch2:
// 处理从 ch2 接收到的数据
case ch3 <- data:
// 发送数据到 ch3
default:
// 如果没有通道准备好,执行默认操作
}
```

5. **通道的阻塞:**
通道的发送和接收操作是阻塞的,这意味着如果没有 Goroutines 准备好发送或接收数据,它们将会等待。这种机制可以用于同步不同 Goroutines 的执行。

6. **通道的方向:**
在函数参数中,可以指定通道的发送或接收方向,以增强代码的类型安全性。例如,`func foo(ch <-chan int)` 表示 `ch` 是一个只接收数据的通道,而 `func bar(ch chan<- int)` 表示 `ch` 是一个只发送数据的通道。

成功输出中间文件:
![Alt text](image-1.png)
# UIUC2014-Mini-Program

0 comments on commit 4d2d1e0

Please sign in to comment.