From f0bea7f45e4720065f99c78e5dabbb8d33483e29 Mon Sep 17 00:00:00 2001 From: oren0e Date: Wed, 17 Dec 2025 08:32:51 +0200 Subject: [PATCH] Fix stopping condition ch05 --- ch05/c-fibers/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch05/c-fibers/src/main.rs b/ch05/c-fibers/src/main.rs index fccc459..8890a34 100644 --- a/ch05/c-fibers/src/main.rs +++ b/ch05/c-fibers/src/main.rs @@ -95,7 +95,7 @@ impl Runtime { let mut pos = self.current; while self.threads[pos].state != State::Ready { pos += 1; - if pos == self.threads.len() { + if (pos + 1) == self.threads.len() { pos = 0; } if pos == self.current {