2 Star 2 Fork 8

王布衣/gox

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
api
cache
cron
encoding/binary
errors
exception
fastjson
gls
http
logger
mdc
num
pool
progressbar
demo
main.go
xget
README.md
bar.go
bar_test.go
print.go
qrterminal
signal
tags
text/encoding
threadlocal
util
.codecov.yml
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
go.mod
go.sum
go.test.sh
push-gitee.sh
push-github.sh
util.md
克隆/下载
main.go 854 Bytes
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"sync"
"time"
pgbar "gitee.com/quant1x/gox/progressbar"
)
func main() {
b := pgbar.NewBar(1, "1st", 20000)
b2 := pgbar.NewBar(2, "2st", 10000)
b3 := pgbar.NewBar(3, "3st", 30000)
b.SetSpeedSection(900, 100)
b2.SetSpeedSection(900, 100)
b3.SetSpeedSection(900, 100)
b4 := pgbar.NewBar(0, "4st", 4000*3)
var wg sync.WaitGroup
wg.Add(4)
go func() {
defer wg.Done()
for i := 0; i < 20000; i++ {
b.Add()
time.Sleep(time.Second / 2000)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 10000; i++ {
b2.Add()
time.Sleep(time.Second / 1000)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 30000; i++ {
b3.Add()
time.Sleep(time.Second / 3000)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 4000; i++ {
b4.Add(3)
time.Sleep(time.Second / 300)
}
}()
wg.Wait()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/gox.git
git@gitee.com:quant1x/gox.git
quant1x
gox
gox
v1.7.4

搜索帮助