go-pattern-examples/creation/24_object_pool/obejct_poo.go

24 lines
263 B
Go
Raw Normal View History

2020-04-24 13:09:58 +03:00
package objectpool
type doctor struct {
name string
kind int //科室
}
type pool chan *doctor
func newPool(total int) pool {
p := make(pool, total)
for i := 0; i < total; i++ {
p <- new(doctor)
}
return p
}
//surgery
func (d doctor) surgery() {
}