mirror of
https://github.com/fumiama/orbyte.git
synced 2026-06-06 10:40:29 +08:00
feat: add async conflict detection
This commit is contained in:
8
pool.go
8
pool.go
@@ -21,6 +21,7 @@ type Pool[T any] struct {
|
||||
pooler Pooler[T]
|
||||
|
||||
noputbak bool
|
||||
issync bool
|
||||
}
|
||||
|
||||
// NewPool make a new pool from custom pooler.
|
||||
@@ -43,6 +44,13 @@ func (pool *Pool[T]) SetNoPutBack(on bool) {
|
||||
pool.noputbak = on
|
||||
}
|
||||
|
||||
// SetSyncItem make it panic on every read-write conflict.
|
||||
//
|
||||
// Enable this to detect coding errors.
|
||||
func (pool *Pool[T]) SetSyncItem(on bool) {
|
||||
pool.issync = on
|
||||
}
|
||||
|
||||
// LimitOutput will automatically set new item no-autodestroy
|
||||
// if countout > outlim.
|
||||
func (pool *Pool[T]) LimitOutput(n int32) {
|
||||
|
||||
Reference in New Issue
Block a user