@@ -35,6 +35,9 @@ func (b *Item[T]) Trans() T {
3535 if b .stat .hasdestroyed () {
3636 panic ("use after destroy" )
3737 }
38+ if b .pool .issync {
39+ b .stat .setinsyncop (true )
40+ }
3841 val := b .val
3942 atomic .StoreUintptr (
4043 (* uintptr )(& b .stat ), uintptr (destroyedstatus ),
@@ -47,6 +50,10 @@ func (b *Item[T]) Trans() T {
4750// HasInvolved whether this item is buffered
4851// and will be Reset on putting back.
4952func (b * Item [T ]) HasInvolved () bool {
53+ if b .pool .issync {
54+ b .stat .setinsyncop (true )
55+ defer b .stat .setinsyncop (false )
56+ }
5057 return b .stat .isbuffered ()
5158}
5259
@@ -57,6 +64,10 @@ func (b *Item[T]) V(f func(T)) {
5764 if b .stat .hasdestroyed () {
5865 panic ("use after destroy" )
5966 }
67+ if b .pool .issync {
68+ b .stat .setinsyncop (true )
69+ defer b .stat .setinsyncop (false )
70+ }
6071 f (b .val )
6172 runtime .KeepAlive (b )
6273}
@@ -68,6 +79,10 @@ func (b *Item[T]) P(f func(*T)) {
6879 if b .stat .hasdestroyed () {
6980 panic ("use after destroy" )
7081 }
82+ if b .pool .issync {
83+ b .stat .setinsyncop (true )
84+ defer b .stat .setinsyncop (false )
85+ }
7186 f (& b .val )
7287 runtime .KeepAlive (b )
7388}
@@ -77,6 +92,10 @@ func (b *Item[T]) Copy() (cb *Item[T]) {
7792 if b .stat .hasdestroyed () {
7893 panic ("use after destroy" )
7994 }
95+ if b .pool .issync {
96+ b .stat .setinsyncop (true )
97+ defer b .stat .setinsyncop (false )
98+ }
8099 cb = b .pool .New (b .cfg )
81100 b .pool .pooler .Copy (& cb .val , & b .val )
82101 return
@@ -100,6 +119,9 @@ func (b *Item[T]) destroybystat(stat status) {
100119// Calling this method only when you're sure that
101120// no one will use it, or it will cause a panic.
102121func (b * Item [T ]) ManualDestroy () {
122+ if b .pool .issync {
123+ b .stat .setinsyncop (true )
124+ }
103125 runtime .SetFinalizer (b , nil )
104126 b .destroybystat (status (atomic .SwapUintptr (
105127 (* uintptr )(& b .stat ), uintptr (destroyedstatus ),
0 commit comments