-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using atomic instead of mutex and delete scratch slice (#1833)
* using atomic instead of mutex and delete scratch slice * optimize struct * fix default bool * escape data race * avoid the momentary change of wp.workersCount. * removed unused tail (for now) * little fixes * fixed allocations This option immediately exits the loop when the maximum number of vorkers is reached, rather than creating a new vorker if the limit is reached. This reduces the frequency of unnecessary operations and potential locks in sync.Pool * Update for linter workerpool.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Update for lint#2 workerpool.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Update for lint#3 workerpool.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * Update for lint#4 workerpool.go * eliminating potential data races --------- Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
- Loading branch information
1 parent
25c52d7
commit 19c50cd
Showing
1 changed file
with
74 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters