diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-12 17:42:51 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-12 17:42:51 -0400 |
| commit | 8b564f6dd15cb3dc3e70a8eb0c30509cd5d624c6 (patch) | |
| tree | f947f61c2acbc9e41944308c50dabb379e0aeed1 /test/threads.tm | |
| parent | 81812b46a0cca168adcde662b6e140adc7e23b1a (diff) | |
Fix deadlock issue
Diffstat (limited to 'test/threads.tm')
| -rw-r--r-- | test/threads.tm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/threads.tm b/test/threads.tm index 7024460c..95cfbb5b 100644 --- a/test/threads.tm +++ b/test/threads.tm @@ -1,12 +1,13 @@ enum Job(Increment(x:Int), Decrement(x:Int)) func main(): - jobs := |:Job; max_size=1| - results := |:Int; max_size=2| + jobs := |:Job; max_size=2| + results := |:Int; max_size| >> thread := Thread.new(func(): //! In another thread! while yes: - when jobs:pop() is Increment(x): + >> got := jobs:pop() + when got is Increment(x): >> results:push(x+1) is Decrement(x): >> results:push(x-1) |
