💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、豆包、星火、月之暗面及文生图、文生视频 广告
### 多资源竞争 ~~~ //打印机属于公共资源 func printer(str string) { for _, data := range str { fmt.Printf("%c\n", data) time.Sleep(time.Second) } } func person1() { printer("hello") } func person2() { printer("world") } func main() { //新建两个协程,代表两个人,2个人同事使用打印机 go person1() go person2() //不让主协程结束 for { } } ~~~ 每次打印结果都不相同: ~~~ w h e o r l l l o d ~~~