From 2b719f2bfabad4e55249dca394c039b6f69b2d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 28 Jul 2023 15:58:36 +0800 Subject: [PATCH] fix: ring loop --- ring.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ring.go b/ring.go index a233498..521d853 100644 --- a/ring.go +++ b/ring.go @@ -61,9 +61,9 @@ func (evr *eventRing) loop(latency, maxwait time.Duration, process func([]byte, continue } process(it.response, it.caller, maxwait) + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&r[i])), unsafe.Pointer(nil)) it.response = nil it.caller = nil - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&r[i])), unsafe.Pointer(nil)) c++ runtime.GC() }