From d2f4d07585d1e915365f3aaea6fc696e00a9e26d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Aug 2024 15:04:22 -0400 Subject: Support channels with maximum size --- test/threads.tm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'test') 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 @@ -22,6 +27,17 @@ func main(): >> results:pop() = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() + = 99 + >> results:pop() = 1001 -- cgit v1.2.3