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

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

  •  
  •   darasion · Apr 19, 2016 · 2257 views
    This topic created in 3684 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
        1
    gamexg  
       Apr 19, 2016
    多线程时将任务推到 chan ,线程池读取并处理。
    其他语言使用回调函数时, go 返回 chan 实现类似的功能。
    spongebobsun
        2
    spongebobsun  
       Apr 20, 2016   ❤️ 1
    干活的 channel 传入 chan 给他,活儿干完了把数据塞回 chan 里面
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3694 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 10:24 · PVG 18:24 · LAX 03:24 · JFK 06:24
    ♥ Do have faith in what you're doing.