mirror of
https://github.com/tmrts/go-patterns.git
synced 2025-02-18 05:23:14 +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)
|
p := pool.New(2)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case obj := <-p:
|
case obj := <-*p:
|
||||||
obj.Do( /*...*/ )
|
obj.Do( /*...*/ )
|
||||||
|
|
||||||
p <- obj
|
*p <- obj
|
||||||
default:
|
default:
|
||||||
// No more objects left — retry later or fail
|
// No more objects left — retry later or fail
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user