aboutsummaryrefslogtreecommitdiff
path: root/test/threads.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-18 23:24:23 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-18 23:24:23 -0400
commit2e8c949fdcf56d6055ed8b78a825d9061ab0ceb4 (patch)
treef3644759f7045185b110f3d81d18067b55feab49 /test/threads.tm
parentb76fbd3beba08c098c6d18578230f9edbc4d3a3d (diff)
Rename push/pop to give/get, since it's not stack-ordered
Diffstat (limited to 'test/threads.tm')
-rw-r--r--test/threads.tm38
1 files changed, 19 insertions, 19 deletions
diff --git a/test/threads.tm b/test/threads.tm
index 95cfbb5b..e8d83f4a 100644
--- a/test/threads.tm
+++ b/test/threads.tm
@@ -6,40 +6,40 @@ func main():
>> thread := Thread.new(func():
//! In another thread!
while yes:
- >> got := jobs:pop()
+ >> got := jobs:get()
when got is Increment(x):
- >> results:push(x+1)
+ >> results:give(x+1)
is Decrement(x):
- >> results:push(x-1)
+ >> results:give(x-1)
)
- >> 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))
+ >> jobs:give(Increment(5))
+ >> jobs:give(Decrement(100))
+ >> jobs:give(Decrement(100))
+ >> jobs:give(Decrement(100))
+ >> jobs:give(Decrement(100))
+ >> jobs:give(Decrement(100))
+ >> jobs:give(Decrement(100))
- >> results:pop()
+ >> results:get()
= 6
- >> jobs:push(Increment(1000))
- >> results:pop()
+ >> jobs:give(Increment(1000))
+ >> results:get()
= 99
- >> results:pop()
+ >> results:get()
= 99
- >> results:pop()
+ >> results:get()
= 99
- >> results:pop()
+ >> results:get()
= 99
- >> results:pop()
+ >> results:get()
= 99
- >> results:pop()
+ >> results:get()
= 99
- >> results:pop()
+ >> results:get()
= 1001
//! Canceling...