瀏覽代碼

Keep `chan.can_recv` from deadlocking

Feoramund 1 年之前
父節點
當前提交
73f5ab473c
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      core/sync/chan/chan.odin

+ 1 - 1
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
 }