diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-11 15:04:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-11 15:04:22 -0400 |
| commit | d2f4d07585d1e915365f3aaea6fc696e00a9e26d (patch) | |
| tree | 12cf2a0f978835bc55db572df8e0d114c9b89494 /test | |
| parent | 2ecb5fe885042ca6c25ee0a3e3da070ddec9e07e (diff) | |
Support channels with maximum size
Diffstat (limited to 'test')
| -rw-r--r-- | test/threads.tm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/threads.tm b/test/threads.tm index 33685103..7024460c 100644 --- a/test/threads.tm +++ b/test/threads.tm @@ -1,8 +1,8 @@ enum Job(Increment(x:Int), Decrement(x:Int)) func main(): - jobs := |:Job| - results := |:Int| + jobs := |:Job; max_size=1| + results := |:Int; max_size=2| >> thread := Thread.new(func(): //! In another thread! while yes: @@ -14,6 +14,11 @@ func main(): >> jobs:push(Increment(5)) >> jobs:push(Decrement(100)) + >> jobs:push(Decrement(100)) + >> jobs:push(Decrement(100)) + >> jobs:push(Decrement(100)) + >> jobs:push(Decrement(100)) + >> jobs:push(Decrement(100)) >> results:pop() = 6 @@ -23,6 +28,17 @@ func main(): = 99 >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + + >> results:pop() = 1001 //! Canceling... |
