/coroutinepool

gocoroutine pool

Primary LanguageGo

coroutinepool

============= go coroutine pool

找到了一个goroutine性能测试
里面提到了goroutine可以并发开启上百万个goroutine,所以这个goroutine pool没有什么实际意义。
当练习吧

License

=== author gonghh
Copyright 2013 gonghh(screscent).
Under the Apache License, Version 2.0.

example

==============================

  • create
coroutinepool.Create(6)

//or

p:=coroutinepool.NewPool()
p.Create(6)
  • run
  for i := 0; i < 100; i++ {
		coroutinepool.Run(func() {
			fmt.Println("test", i)
		})
  }

//or
  for i := 0; i < 100; i++ {
		p.Run(func() {
			fmt.Println("test", i)
		})
  }
  
  • exit
coroutinepool.Exit()

//or
p.Exit()