fix some typo (#677)

This commit is contained in:
heyanfu
2021-05-10 00:09:00 +08:00
committed by GitHub
parent 8478474f7f
commit a5962f677f
7 changed files with 8 additions and 8 deletions

View File

@@ -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()

View File

@@ -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() {

View File

@@ -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
}

View File

@@ -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()

View File

@@ -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