From ae410f8def7bddc121dbd4e3efdb0dc677d6c614 Mon Sep 17 00:00:00 2001 From: Akinlua Bolamigbe Date: Sat, 18 Mar 2023 19:23:36 +0100 Subject: [PATCH] fixed a memory bug --- eventloop.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eventloop.go b/eventloop.go index 5cf9ac6..5f93d48 100644 --- a/eventloop.go +++ b/eventloop.go @@ -100,11 +100,11 @@ func (e *eventLoop) Main(fn func()) { func (e *eventLoop) awaitAll() { for { - e.sync.Lock() n := len(e.promiseQueue) - e.sync.Unlock() for i := n - 1; i >= 0; i-- { + e.sync.Lock() p := e.promiseQueue[i] + e.sync.Unlock() if p.handler { <-p.done //TODO clean up memory (promise)