diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 00:31:55 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 00:31:55 -0700 |
commit | 08f4628e8b858120fe3547d8e5431d9abfe46bf8 (patch) | |
tree | 4d9f1bc0039baefa0e84d9cb3ea6634f4337d342 /channel.mu | |
parent | 58a9f7c34e21541f2db90b7fb66f4e92f04780ef (diff) | |
download | mu-08f4628e8b858120fe3547d8e5431d9abfe46bf8.tar.gz |
3379
Can't use type abbreviations inside 'memory-should-contain'.
Diffstat (limited to 'channel.mu')
-rw-r--r-- | channel.mu | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/channel.mu b/channel.mu index e2e1e758..b9054b56 100644 --- a/channel.mu +++ b/channel.mu @@ -1,11 +1,11 @@ # example program: communicating between routines using channels -def producer sink:address:sink:character -> sink:address:sink:character [ +def producer sink:address:sink:char -> sink:address:sink:char [ # produce characters 1 to 5 on a channel local-scope load-ingredients # n = 0 - n:character <- copy 0 + n:char <- copy 0 { done?:boolean <- lesser-than n, 5 break-unless done? @@ -19,16 +19,16 @@ def producer sink:address:sink:character -> sink:address:sink:character [ close sink ] -def consumer source:address:source:character -> source:address:source:character [ +def consumer source:address:source:char -> source:address:source:char [ # consume and print integers from a channel local-scope load-ingredients { # read an integer from the channel - n:character, eof?:boolean, source <- read source + n:char, eof?:boolean, source <- read source break-if eof? # other threads might get between these prints - $print [consume: ], n:character, [ + $print [consume: ], n:char, [ ] loop } @@ -36,7 +36,7 @@ def consumer source:address:source:character -> source:address:source:character def main [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 3/capacity + source:address:source:char, sink:address:sink:char <- new-channel 3/capacity # create two background 'routines' that communicate by a channel routine1:number <- start-running producer, sink routine2:number <- start-running consumer, source |