Rendezvous: Difference between revisions

Content added Content deleted
Line 996: Line 996:
{"reserve",5}}
{"reserve",5}}


procedure printer(sequence args)
procedure printer(string name, sequence s)
{string name, sequence s} = args
try
try
for i=1 to length(s) do
for i=1 to length(s) do
Line 1,021: Line 1,020:
constant r_printer = routine_id("printer")
constant r_printer = routine_id("printer")


constant hd = {"hd",{"Humpty Dumpty sat on a wall.",
constant hd = {"Humpty Dumpty sat on a wall.",
"Humpty Dumpty had a great fall.",
"Humpty Dumpty had a great fall.",
"All the king's horses and all the king's men",
"All the king's horses and all the king's men",
"Couldn't put Humpty together again."}},
"Couldn't put Humpty together again."},
mg = {"mg",{"Old Mother Goose",
mg = {"Old Mother Goose",
"When she wanted to wander,",
"When she wanted to wander,",
"Would ride through the air",
"Would ride through the air",
"On a very fine gander.",
"On a very fine gander.",
"Jack's mother came in,",
"Jack's mother came in,",
"And caught the goose soon,",
"And caught the goose soon,",
"And mounting its back,",
"And mounting its back,",
"Flew up to the moon."}}
"Flew up to the moon."}


sequence hThreads = {create_thread(r_printer,{hd}),
sequence hThreads = {create_thread(r_printer,{"hd",hd}),
create_thread(r_printer,{mg})}
create_thread(r_printer,{"mg",mg})}
wait_thread(hThreads)</lang>
wait_thread(hThreads)</lang>
{{out}}
{{out}}