Created
July 2, 2024 10:05
-
-
Save noname007/6fd0a23920fa115618dbef2504511727 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Golang 面试题 (4) N个协程交替打印1-100 | |
| 启动N个协程,共用一个外部变量计数器,计数器范围是1到100 | |
| 开启N个有缓冲chan,chans[i]塞入数据代表协程i可以进行打印了,打印的数字就是计数器的数 | |
| 协程i一直阻塞,直到chan[i]通道有数据可以拉,才打印 |
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.