mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-12-01 23:56:02 +03:00
24 lines
263 B
Go
24 lines
263 B
Go
|
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() {
|
||
|
|
||
|
}
|