Skip to content

fix: replace removed Thread.sleep in concurrency.md (#314) - #315

Merged
magnus-madsen merged 1 commit into
masterfrom
fix-thread-sleep-314
Jun 7, 2026
Merged

fix: replace removed Thread.sleep in concurrency.md (#314)#315
magnus-madsen merged 1 commit into
masterfrom
fix-thread-sleep-314

Conversation

@magnus-madsen

Copy link
Copy Markdown
Member

Summary

Thread.sleep has been removed from Flix (#314). The only references were in src/concurrency.md. Two related APIs are also gone in the current version: Time.Duration.fromSeconds(...) and the single-argument Channel.timeout(...).

Changes

  • Structured-concurrency example — removed the slowPrint helper, which only existed to inject a Thread.sleep delay; now spawns println directly. The region-lifetime point it illustrates is unchanged.
  • Timeout example — the slow sender genuinely needs to be slow or the select timeout never fires. The new Sleep effect is not allowed inside spawn, so the delay is reproduced with a Channel.timeout receiver (Chan + IO, both legal in spawn). Updated both Channel.timeout calls to the two-argument (Int32, Time.TimeUnit) form.

No prose changes were needed — surrounding text remains accurate (the slow function still takes a minute; the program still prints "timeout" after five seconds).

Verification

Both examples checked against the current API (api.flix.dev) and compiled cleanly with flix check (Flix 0.72.0).

Closes #314

🤖 Generated with Claude Code

Thread.sleep, Time.Duration.fromSeconds, and the single-arg
Channel.timeout no longer exist in the current Flix API.

- Drop the slowPrint helper from the structured-concurrency example;
  it only existed to inject a Thread.sleep delay.
- In the timeout example, reproduce the slow sender's delay with a
  Channel.timeout receiver (Chan + IO, both legal in spawn) since the
  new Sleep effect is not allowed inside spawn. Update Channel.timeout
  calls to the two-argument (Int32, Time.TimeUnit) form.

Both examples verified with flix check (0.72.0).

Closes #314

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@magnus-madsen
magnus-madsen merged commit 8934f1e into master Jun 7, 2026
1 check passed
@magnus-madsen
magnus-madsen deleted the fix-thread-sleep-314 branch June 7, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Thread.sleep no longer exists

1 participant