mirror of
https://github.com/tmrts/go-patterns.git
synced 2024-11-21 20:46:08 +03:00
Update object-pool.md
Because the type of p at line 29 is"*chan *Object" , so at line 32, 35 should use *p instead of p directly.
This commit is contained in:
parent
f978e42036
commit
611bda0fb9
@ -29,10 +29,10 @@ Given below is a simple lifecycle example on an object pool.
|
||||
p := pool.New(2)
|
||||
|
||||
select {
|
||||
case obj := <-p:
|
||||
case obj := <-*p:
|
||||
obj.Do( /*...*/ )
|
||||
|
||||
p <- obj
|
||||
*p <- obj
|
||||
default:
|
||||
// No more objects left — retry later or fail
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user