aboutsummaryrefslogtreecommitdiff
path: root/core/sync
diff options
context:
space:
mode:
authorJack Mordaunt <jackmordaunt.dev@gmail.com>2025-06-08 18:28:35 -0300
committerJack Mordaunt <jackmordaunt.dev@gmail.com>2025-06-12 16:14:52 -0300
commitfb39e5a2f8a051c1df17da199bf46e373c7bcb03 (patch)
tree59149e9443cd7764a2a50f6f69c99f9f9181ed2b /core/sync
parentd5b7302ac047dd4c5ee9656d405c84268e27b242 (diff)
core/sync/chan.try_select_raw: clarify loop control flow
Use a label to clarify the continue statements.
Diffstat (limited to 'core/sync')
-rw-r--r--core/sync/chan/chan.odin7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/sync/chan/chan.odin b/core/sync/chan/chan.odin
index d20e7d365..f8f3ac46e 100644
--- a/core/sync/chan/chan.odin
+++ b/core/sync/chan/chan.odin
@@ -1125,6 +1125,7 @@ and which are available for sending. It then randomly selects one operation
If no channels have messages ready, the procedure is a noop.
Note: Each message in `send_msgs` corresponds to the send channel at the same index in `sends`.
+If the message is nil, corresponding send channel will be skipped.
**Inputs**
- `recv`: A slice of channels to read from
@@ -1190,7 +1191,7 @@ try_select_raw :: proc "odin" (recvs: []^Raw_Chan, sends: []^Raw_Chan, send_msgs
candidate_count := builtin.len(recvs)+builtin.len(sends)
candidates := ([^]Select_Op)(intrinsics.alloca(candidate_count*size_of(Select_Op), align_of(Select_Op)))
- for {
+ try_loop: for {
count := 0
for c, i in recvs {
@@ -1223,12 +1224,12 @@ try_select_raw :: proc "odin" (recvs: []^Raw_Chan, sends: []^Raw_Chan, send_msgs
if sel.is_recv {
status = .Recv
if !try_recv_raw(recvs[sel.idx], recv_out) {
- continue
+ continue try_loop
}
} else {
status = .Send
if !try_send_raw(sends[sel.idx], send_msgs[sel.idx]) {
- continue
+ continue try_loop
}
}