diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-29 01:23:22 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-29 01:23:22 -0700 |
commit | ce87c19ee42bc52c5ab9a1ee3c431a9423e5a885 (patch) | |
tree | 126e2445997e1d5a35d80f2999744654dfe8e721 /channel.mu | |
parent | c91caafd5bd5dae25b0e0efa19879258ff61ad93 (diff) | |
download | mu-ce87c19ee42bc52c5ab9a1ee3c431a9423e5a885.tar.gz |
1880 - switch .mu files to new type-deducing idiom
Diffstat (limited to 'channel.mu')
-rw-r--r-- | channel.mu | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/channel.mu b/channel.mu index eb5b9641..ffa6d9f6 100644 --- a/channel.mu +++ b/channel.mu @@ -7,13 +7,13 @@ recipe producer [ # n = 0 n:number <- copy 0 { - done?:boolean <- lesser-than n:number, 5 - break-unless done?:boolean + done?:boolean <- lesser-than n, 5 + break-unless done? # other threads might get between these prints - $print [produce: ], n:number, [ + $print [produce: ], n, [ ] - chan:address:channel <- write chan:address:channel, n:number - n:number <- add n:number, 1 + chan:address:channel <- write chan, n + n <- add n, 1 loop } ] @@ -24,7 +24,7 @@ recipe consumer [ chan:address:channel <- next-ingredient { # read an integer from the channel - n:number, chan:address:channel <- read chan:address:channel + n:number, chan:address:channel <- read chan # other threads might get between these prints $print [consume: ], n:number, [ ] @@ -36,8 +36,8 @@ recipe main [ local-scope chan:address:channel <- new-channel 3 # create two background 'routines' that communicate by a channel - routine1:number <- start-running producer:recipe, chan:address:channel - routine2:number <- start-running consumer:recipe, chan:address:channel - wait-for-routine routine1:number - wait-for-routine routine2:number + routine1:number <- start-running producer:recipe, chan + routine2:number <- start-running consumer:recipe, chan + wait-for-routine routine1 + wait-for-routine routine2 ] |