diff options
| author | Jack Mordaunt <jackmordaunt.dev@gmail.com> | 2025-06-08 18:29:26 -0300 |
|---|---|---|
| committer | Jack Mordaunt <jackmordaunt.dev@gmail.com> | 2025-06-12 16:14:52 -0300 |
| commit | 4043be85678e979996286c5269cfa35a7f10edac (patch) | |
| tree | c6b5ed4e3d147ebfa610930c60c96e0398d9e1c8 /core/sync | |
| parent | fb39e5a2f8a051c1df17da199bf46e373c7bcb03 (diff) | |
core/sync/chan.try_select_raw: skip nil input messages
This makes the proc easier and safer to call by letting the caller nil
out messages to skip sends.
Diffstat (limited to 'core/sync')
| -rw-r--r-- | core/sync/chan/chan.odin | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/sync/chan/chan.odin b/core/sync/chan/chan.odin index f8f3ac46e..2c34f7bb3 100644 --- a/core/sync/chan/chan.odin +++ b/core/sync/chan/chan.odin @@ -1205,7 +1205,10 @@ try_select_raw :: proc "odin" (recvs: []^Raw_Chan, sends: []^Raw_Chan, send_msgs } for c, i in sends { - if can_send(c) { + if i > builtin.len(send_msgs)-1 || send_msgs[i] == nil { + continue + } + if can_send(c) { candidates[count] = { is_recv = false, idx = i, |