mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Keep chan.can_recv from deadlocking
This commit is contained in:
@@ -423,7 +423,7 @@ raw_queue_pop :: proc "contextless" (q: ^Raw_Queue) -> (data: rawptr) {
|
|||||||
can_recv :: proc "contextless" (c: ^Raw_Chan) -> bool {
|
can_recv :: proc "contextless" (c: ^Raw_Chan) -> bool {
|
||||||
sync.guard(&c.mutex)
|
sync.guard(&c.mutex)
|
||||||
if is_buffered(c) {
|
if is_buffered(c) {
|
||||||
return len(c) > 0
|
return c.queue.len > 0
|
||||||
}
|
}
|
||||||
return sync.atomic_load(&c.w_waiting) > 0
|
return sync.atomic_load(&c.w_waiting) > 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user