The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
darasion

关于 channel 与 func, 什么时候应该通过参数传入 chan,什么时候应该返回 chan?

  •  
  •   darasion · Apr 19, 2016 · 2678 views
    This topic created in 3858 days ago, the information mentioned may be changed or developed.
    看了一些文章,比如:
    https://blog.golang.org/pipelines
    https://golang.org/doc/codewalk/sharemem/

    都没细说过这事,大家的经验是?
    2 replies  •  2016-04-20 09:58:37 +08:00
    gamexg
    gamexg
    Apr 19, 2016
    1
    多线程时将任务推到 chan ,线程池读取并处理。
    其他语言使用回调函数时, go 返回 chan 实现类似的功能。
    spongebobsun
    spongebobsun
    Apr 20, 2016❤️1
    2
    干活的 channel 传入 chan 给他,活儿干完了把数据塞回 chan 里面
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2312 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 12:39 · PVG 20:39 · LAX 04:39 · JFK 07:39
    ♥ Do have faith in what you're doing.