Go's goroutine is a thread pool. It maps M tasks over N threads. It has its own scheduler, etc. It reuses threads and avoids the overhead of unnecessary thread creation. I don't understand why you need to create a pool on top of another pool.
On Saturday, February 18, 2023 at 11:43:57 PM UTC+7 junior zhang wrote: > > Go Playground - The Go Programming Language > <https://go.dev/play/p/djBu4lQos_d> > > Hello everyone, this is a scheduling program similar to a WorkerPool that > I implemented in Golang. The purpose of this program is to limit the number > of goroutines while still allowing concurrent execution of my tasks. As a > beginner in Golang, I may have overlooked some bugs in my code despite the > fact that the main method runs and executes perfectly. There may be hidden > bugs, such as goroutine leaks, deadlock bugs, or improper use of channels. > I would appreciate it if you could help me review the code. Thank you. > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/17155088-8561-4e06-aba4-059e1a2519e6n%40googlegroups.com.