Fix block_caller · ruby/mspec@d84d766 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit d84d766
Fix block_caller
* First wait the Thread start, then wait until it blocks or finishes. * The bug would be to quit as soon as started is set, even if the Thread never blocked. * Fixes #39.
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -10,7 +10,11 @@ def matches?(block) | ||
10 | 10 | blocking = false |
11 | 11 | end |
12 | 12 | |
13 | -while !started and status = thread.status and status != "sleep" | |
13 | +Thread.pass while !started | |
14 | + | |
15 | +# Wait until the Thread status is "sleep" (then it's blocking) | |
16 | +# or nil (the Thread finished execution, it did not block) | |
17 | +while status = thread.status and status != "sleep" | |
14 | 18 | Thread.pass |
15 | 19 | end |
16 | 20 | thread.kill |