Forbid chan.try_send on closed buffered channels

This commit is contained in:
Feoramund
2024-09-09 16:04:18 -04:00
parent 026aef69e3
commit e9a6a34480

View File

@@ -260,6 +260,10 @@ try_send_raw :: proc "contextless" (c: ^Raw_Chan, msg_in: rawptr) -> (ok: bool)
return false
}
if sync.atomic_load(&c.closed) {
return false
}
ok = raw_queue_push(c.queue, msg_in)
if sync.atomic_load(&c.r_waiting) > 0 {
sync.signal(&c.r_cond)