From 5721b66feb1028586a1a59a9982a831665e065f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E5=B0=8F=E5=86=9B?= Date: Sun, 15 Sep 2019 21:18:27 +0800 Subject: [PATCH] new --- go.mod | 2 +- go.sum | 3 --- main.go | 9 +++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 50afa43..d9126b5 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gowp +module github.com/xxjwxc/gowp go 1.13 diff --git a/go.sum b/go.sum index 3cba325..94331e7 100644 --- a/go.sum +++ b/go.sum @@ -17,11 +17,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= -github.com/xxjwxc/public v0.0.0-20190915113632-d369d5187200 h1:Hi8KKUGp+xh+x6WA/3KNmvvEvjcHFKZ6NJOduAL92k4= -github.com/xxjwxc/public v0.0.0-20190915113632-d369d5187200/go.mod h1:rgW5aGDrLzmJM8NtrtskcxerGFyvn1OK3+Ra52YeZS0= github.com/xxjwxc/public v0.0.0-20190915122658-9831b23af2e1 h1:nCgYwrp2ZbumdJvgkyJ3+KXBaLWipRSDUujE0GdNKAU= github.com/xxjwxc/public v0.0.0-20190915122658-9831b23af2e1/go.mod h1:rgW5aGDrLzmJM8NtrtskcxerGFyvn1OK3+Ra52YeZS0= -github.com/xxjwxc/public v1.0.4 h1:C16i87ODAsabmsun+7MEoK7goPjWNGTQOYg+53PzzCw= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/main.go b/main.go index e03227c..566d56d 100644 --- a/main.go +++ b/main.go @@ -2,16 +2,17 @@ package main import ( "fmt" - "gowp/workerpool" "time" + + "github.com/xxjwxc/gowp/workerpool" ) func main() { - wp := workerpool.New(5) //设置最大线程数 - for i := 0; i < 100; i++ { //开启20个请求 + wp := workerpool.New(5) //设置最大线程数 + for i := 0; i < 10; i++ { //开启10个请求 ii := i wp.Do(func() error { - for j := 0; j < 50; j++ { //每次打印0-10的值 + for j := 0; j < 5; j++ { //每次打印0-10的值 fmt.Println(fmt.Sprintf("%v->\t%v", ii, j)) time.Sleep(1 * time.Second) }