aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/threads.tm20
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...