golang/%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9/%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95%E9%A2%98%E7%9B%AE%E4%B8%80 #52
Replies: 3 comments
-
|
第8题没错吧 因为按照顺序执行的 写完再关 即使关了channel 也可以继续读啊 也没有泄漏问题 除非你的写也是协程的? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
第7题 还有2问题:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
第7题中
应该在引发panic的协程开始处调用 func (p *Project) exec(msgchan chan interface{}) {
defer p.deferError()
for msg := range msgchan {
m := msg.(int)
fmt.Println("msg: ", m)
}
}
``
`run`函数中通过死循环不断产生新的协程,其实不会引发协程堆积,因为exec函数自己会引发panic退出去。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
golang/%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9/%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95%E9%A2%98%E7%9B%AE%E4%B8%80
常见语法题目 一 1、下面代码能运行吗?为什么。 解析 共发现两个问题: main 函数不能加数字。 new 关键字无法初始化 Show 结构体中的 Param 属性,所以直接对 s.Param 操作会出错。 2、请说出下面代码存在什么问题。 解析: golang中有规定,switch type的case T1,类型列表只有一个,那么v := m.(t...
https://golangguide.top/golang/%E6%A0%B8%E5%BF%83%E7%9F%A5%E8%AF%86%E7%82%B9/%E5%B8%B8%E8%A7%81%E8%AF%AD%E6%B3%95%E9%A2%98%E7%9B%AE%E4%B8%80.html
Beta Was this translation helpful? Give feedback.
All reactions