diff --git a/core/state/statedb.go b/core/state/statedb.go index 30a134e1cd..f173da0b92 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -33,7 +33,7 @@ import ( "github.com/ethereum/go-ethereum/core/tracing" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/internal/workerpool" + "github.com/ethereum/go-ethereum/internal/syncx" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/trie" @@ -1162,7 +1162,7 @@ func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool) (common.Hash, er code = s.db.DiskDB().NewBatch() lock sync.Mutex ) - workers := workerpool.New[*stateObject, error](len(s.mutations), min(len(s.mutations), runtime.NumCPU()), + workers := syncx.NewWorkerPool[*stateObject, error](len(s.mutations), min(len(s.mutations), runtime.NumCPU()), func(obj *stateObject) error { // Write any storage changes in the state object to its storage trie set, err := obj.commit() diff --git a/internal/workerpool/workerpool.go b/internal/syncx/workerpool.go similarity index 88% rename from internal/workerpool/workerpool.go rename to internal/syncx/workerpool.go index 431265a79f..f207ac669e 100644 --- a/internal/workerpool/workerpool.go +++ b/internal/syncx/workerpool.go @@ -14,8 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -// Package workerpool implements a concurrent task processor. -package workerpool +package syncx import ( "runtime" @@ -30,10 +29,10 @@ type WorkerPool[T any, R any] struct { working sync.WaitGroup // Waitgroup blocking on worker liveness } -// New creates a worker pool with the given number of max task capacity and an -// optional goroutine count to execute on. If 0 threads are requested, the pool -// will default to the number of (logical) CPUs. -func New[T any, R any](tasks int, threads int, f func(T) R) *WorkerPool[T, R] { +// NewWorkerPool creates a worker pool with the given number of max task capacity +// and an optional goroutine count to execute on. If 0 threads are requested, the +// pool will default to the number of (logical) CPUs. +func NewWorkerPool[T any, R any](tasks int, threads int, f func(T) R) *WorkerPool[T, R] { // Create the worker pool pool := &WorkerPool[T, R]{ tasks: make(chan T, tasks),