编译安装:
./configure –enable-shared
make -j8 &&make install
安装setuptools
tar xf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py install
安装fabric
执行安装时,软件会自动从网上查找依赖的安装包并进行安装
tar xf fabric-0.9rc2.tar.gz
cd goosemo-fabric-1eacbf2
python setup.py install
goroutine和channel是Go语言非常棒的特色,它们提供了一种非常轻便易用的并发能力。但是当您的应用进程中有很多goroutine的时候,如何在主流程中等待所有的goroutine 退出呢?1 通过Channel传递退出信号
Go的一大设计哲学就是:通过Channel共享数据,而不是通过共享内存共享数据。主流程可以通过channel向任何goroutine发送停止信号,就像下面这样:
func run(done chan int) {
for {
select {
case <-done:
fmt.Println("exiting...")
done <- 1
break
default:
}
time.Sleep(time.Second * 1)
fmt.Println("do something")
}
}