From 73f5ab473c4129ae209838d7967286684ac3f462 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:18:01 -0400 Subject: [PATCH] Keep `chan.can_recv` from deadlocking --- core/sync/chan/chan.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/sync/chan/chan.odin b/core/sync/chan/chan.odin index 53a3bff4b..aca08d82e 100644 --- a/core/sync/chan/chan.odin +++ b/core/sync/chan/chan.odin @@ -423,7 +423,7 @@ raw_queue_pop :: proc "contextless" (q: ^Raw_Queue) -> (data: rawptr) { can_recv :: proc "contextless" (c: ^Raw_Chan) -> bool { sync.guard(&c.mutex) if is_buffered(c) { - return len(c) > 0 + return c.queue.len > 0 } return sync.atomic_load(&c.w_waiting) > 0 }