diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 23:59:13 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 23:59:13 -0400 |
| commit | 8363d53bd27c621cb342fea15736a3b11231f2a4 (patch) | |
| tree | 094530cdd947f57197171f1dda58057739d63151 /test/threads.tm | |
| parent | 9e07c6adc7a0616eec40e78024a8501ec7d96559 (diff) | |
Update channel API to take a Where parameter
Diffstat (limited to 'test/threads.tm')
| -rw-r--r-- | test/threads.tm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/threads.tm b/test/threads.tm index f7acd013..09ec7dc2 100644 --- a/test/threads.tm +++ b/test/threads.tm @@ -1,6 +1,24 @@ enum Job(Increment(x:Int), Decrement(x:Int)) func main(): + + do: + >> channel := |:Int| + >> channel:give(10) + >> channel:give(20) + >> channel:give(30) + >> channel:view() + = [10, 20, 30] + >> channel:peek() + = 10 + >> channel:peek(End) + = 30 + + >> channel:give(-10, Start) + >> channel:view() + = [-10, 10, 20, 30] + + jobs := |:Job; max_size=2| >> jobs:give(Increment(5)) >> jobs:peek() |
