https://talks.golang.org/2013/advconc.slide#5

It's easy to go, but how to stop?

Long-lived programs need to clean up.

Let's look at how to write programs that handle communication, periodic events, and cancellation.

The core is Go's select statement: like a switch, but the decision is made based on the ability to communicate.

select {
case xc <- x:
    // sent x on xc
case y := <-yc:
    // received y from yc
}

 

相关文章:

  • 2022-12-23
  • 2021-09-20
  • 2022-01-11
  • 2021-11-15
  • 2021-10-19
  • 2022-12-23
  • 2021-06-15
猜你喜欢
  • 2021-07-08
  • 2022-01-04
  • 2021-06-23
  • 2022-01-01
  • 2021-11-10
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案