diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-09-09 16:05:29 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-09-10 14:52:20 -0400 |
| commit | 8a14a656fbd8843628b61e5a20877b40b772482c (patch) | |
| tree | 25af7c45b31c2c16e3bc00b613c6cbe497bb0a07 /core/sync | |
| parent | e9a6a344809daf5c0a3b725dd52e1527382d8c41 (diff) | |
Fix `chan.can_send` for unbuffered channels
`w_waiting` is the signal that says a caller is waiting to be able to
send something. It is incremented upon send and - in the case of an
unbuffered channel - it can only hold one message.
Therefore, check that `w_waiting` is zero instead.
Diffstat (limited to 'core/sync')
| -rw-r--r-- | core/sync/chan/chan.odin | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/sync/chan/chan.odin b/core/sync/chan/chan.odin index f0b04f3b4..5b9a764b4 100644 --- a/core/sync/chan/chan.odin +++ b/core/sync/chan/chan.odin @@ -444,7 +444,7 @@ can_send :: proc "contextless" (c: ^Raw_Chan) -> bool { if is_buffered(c) { return c.queue.len < c.queue.cap } - return sync.atomic_load(&c.r_waiting) > 0 + return sync.atomic_load(&c.w_waiting) == 0 } |