fix some typo (#677)

master
heyanfu 4 years ago committed by GitHub
parent 8478474f7f
commit a5962f677f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -71,7 +71,7 @@ func NewQueue(producerFactory ProducerFactory, consumerFactory ConsumerFactory)
return q
}
// AddListener adds a litener to q.
// AddListener adds a listener to q.
func (q *Queue) AddListener(listener Listener) {
q.listeners = append(q.listeners, listener)
}

@ -22,7 +22,7 @@ var (
cores uint64
)
// if /proc not present, ignore the cpu calcuation, like wsl linux
// if /proc not present, ignore the cpu calculation, like wsl linux
func init() {
cpus, err := perCpuUsage()
if err != nil {

@ -18,7 +18,7 @@ func NewManagedResource(generate func() interface{}, equals func(a, b interface{
}
}
// MarkBroken marks the resouce broken.
// MarkBroken marks the resource broken.
func (mr *ManagedResource) MarkBroken(resource interface{}) {
mr.lock.Lock()
defer mr.lock.Unlock()

@ -2,7 +2,7 @@ package syncx
import "sync"
// Once returns a func that guanartees fn can only called once.
// Once returns a func that guarantees fn can only called once.
func Once(fn func()) func() {
once := new(sync.Once)
return func() {

@ -2,7 +2,7 @@ package syncx
import "sync/atomic"
// A OnceGuard is used to make sure a resouce can be taken once.
// A OnceGuard is used to make sure a resource can be taken once.
type OnceGuard struct {
done uint32
}

@ -19,7 +19,7 @@ type (
// A Pool is used to pool resources.
// The difference between sync.Pool is that:
// 1. the limit of the resouces
// 1. the limit of the resources
// 2. max age of the resources can be set
// 3. the method to destroy resources can be customized
Pool struct {
@ -56,7 +56,7 @@ func NewPool(n int, create func() interface{}, destroy func(interface{}), opts .
return pool
}
// Get gets a resouce.
// Get gets a resource.
func (p *Pool) Get() interface{} {
p.lock.Lock()
defer p.lock.Unlock()

@ -8,7 +8,7 @@ import (
// ErrUseOfCleaned is an error that indicates using a cleaned resource.
var ErrUseOfCleaned = errors.New("using a cleaned resource")
// A RefResource is used to reference counting a resouce.
// A RefResource is used to reference counting a resource.
type RefResource struct {
lock sync.Mutex
ref int32

Loading…
Cancel
Save