forked from mirror/ants
repo fixes
This commit is contained in:
parent
3fbd9567c9
commit
8a39ec0e4a
|
@ -9,7 +9,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
<a title="Chat Room" target="_blank" href="https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/ants-pool/ants.svg" /></a>
|
<a title="Chat Room" target="_blank" href="https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/ants-pool/ants.svg" /></a>
|
||||||
<a title="Go Report Card" target="_blank" href="https://goreportcard.com/report/github.com/panjf2000/ants"><img src="https://goreportcard.com/badge/github.com/panjf2000/ants?style=flat-square" /></a>
|
<a title="Go Report Card" target="_blank" href="https://goreportcard.com/report/github.com/panjf2000/ants"><img src="https://goreportcard.com/badge/github.com/panjf2000/ants?style=flat-square" /></a>
|
||||||
<a title="Doc for ants" target="_blank" href="https://pkg.go.dev/github.com/panjf2000/ants/v2?tab=doc"><img src="https://img.shields.io/badge/go.dev-doc-007d9c?style=flat-square&logo=read-the-docs" /></a>
|
<a title="Doc for ants" target="_blank" href="https://pkg.go.dev/git.internal/re/ants/v2?tab=doc"><img src="https://img.shields.io/badge/go.dev-doc-007d9c?style=flat-square&logo=read-the-docs" /></a>
|
||||||
<a title="Mentioned in Awesome Go" target="_blank" href="https://github.com/avelino/awesome-go#goroutines"><img src="https://awesome.re/mentioned-badge-flat.svg" /></a>
|
<a title="Mentioned in Awesome Go" target="_blank" href="https://github.com/avelino/awesome-go#goroutines"><img src="https://awesome.re/mentioned-badge-flat.svg" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ go get -u github.com/panjf2000/ants
|
||||||
### For `ants` v2 (with GO111MODULE=on)
|
### For `ants` v2 (with GO111MODULE=on)
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
go get -u github.com/panjf2000/ants/v2
|
go get -u git.internal/re/ants/v2
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🛠 How to use
|
## 🛠 How to use
|
||||||
|
@ -72,7 +72,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/panjf2000/ants/v2"
|
"git.internal/re/ants/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var sum int32
|
var sum int32
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
<a title="Chat Room" target="_blank" href="https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/ants-pool/ants.svg" /></a>
|
<a title="Chat Room" target="_blank" href="https://gitter.im/ants-pool/ants?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/ants-pool/ants.svg" /></a>
|
||||||
<a title="Go Report Card" target="_blank" href="https://goreportcard.com/report/github.com/panjf2000/ants"><img src="https://goreportcard.com/badge/github.com/panjf2000/ants?style=flat-square" /></a>
|
<a title="Go Report Card" target="_blank" href="https://goreportcard.com/report/github.com/panjf2000/ants"><img src="https://goreportcard.com/badge/github.com/panjf2000/ants?style=flat-square" /></a>
|
||||||
<a title="Doc for ants" target="_blank" href="https://pkg.go.dev/github.com/panjf2000/ants/v2?tab=doc"><img src="https://img.shields.io/badge/go.dev-doc-007d9c?style=flat-square&logo=read-the-docs" /></a>
|
<a title="Doc for ants" target="_blank" href="https://pkg.go.dev/git.internal/re/ants/v2?tab=doc"><img src="https://img.shields.io/badge/go.dev-doc-007d9c?style=flat-square&logo=read-the-docs" /></a>
|
||||||
<a title="Mentioned in Awesome Go" target="_blank" href="https://github.com/avelino/awesome-go#goroutines"><img src="https://awesome.re/mentioned-badge-flat.svg" /></a>
|
<a title="Mentioned in Awesome Go" target="_blank" href="https://github.com/avelino/awesome-go#goroutines"><img src="https://awesome.re/mentioned-badge-flat.svg" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ go get -u github.com/panjf2000/ants
|
||||||
### 使用 `ants` v2 版本 (开启 GO111MODULE=on):
|
### 使用 `ants` v2 版本 (开启 GO111MODULE=on):
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
go get -u github.com/panjf2000/ants/v2
|
go get -u git.internal/re/ants/v2
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🛠 使用
|
## 🛠 使用
|
||||||
|
@ -72,7 +72,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/panjf2000/ants/v2"
|
"git.internal/re/ants/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var sum int32
|
var sum int32
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/panjf2000/ants/v2"
|
"git.internal/re/ants/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var sum int32
|
var sum int32
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/panjf2000/ants/v2
|
module git.internal/re/ants/v2
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
Benchmark result for three types of locks:
|
Benchmark result for three types of locks:
|
||||||
goos: darwin
|
goos: darwin
|
||||||
goarch: amd64
|
goarch: amd64
|
||||||
pkg: github.com/panjf2000/ants/v2/internal
|
pkg: git.internal/re/ants/v2/internal
|
||||||
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
|
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
|
||||||
BenchmarkMutex-12 20549502 71.84 ns/op 0 B/op 0 allocs/op
|
BenchmarkMutex-12 20549502 71.84 ns/op 0 B/op 0 allocs/op
|
||||||
BenchmarkSpinLock-12 58629697 20.02 ns/op 0 B/op 0 allocs/op
|
BenchmarkSpinLock-12 58629697 20.02 ns/op 0 B/op 0 allocs/op
|
||||||
|
|
2
pool.go
2
pool.go
|
@ -28,7 +28,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/panjf2000/ants/v2/internal"
|
"git.internal/re/ants/v2/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Pool accepts the tasks from client, it limits the total of goroutines to a given number by recycling goroutines.
|
// Pool accepts the tasks from client, it limits the total of goroutines to a given number by recycling goroutines.
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/panjf2000/ants/v2/internal"
|
"git.internal/re/ants/v2/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PoolWithFunc accepts the tasks from client,
|
// PoolWithFunc accepts the tasks from client,
|
||||||
|
|
Loading…
Reference in New Issue