1
0
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:
源文雨
2025-04-14 22:41:19 +09:00
parent ac9d26dfb9
commit 162407d64e
8 changed files with 86 additions and 17 deletions

View File

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