1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2024-11-25 06:26:06 +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:
murmur-wheel 2020-02-06 12:57:51 +08:00 committed by GitHub
parent f978e42036
commit 611bda0fb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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