1
0
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:
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) 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