Rendezvous: Difference between revisions

m
Line 816:
line = take!(printer.inputpath)
linesprinted = 0
if (printer.inkremaining < 1)
if(printer.reserve == printer)
put!(printer.errorpath, "Error: printer $(printer.name) out of ink")
Line 838:
printers = [mainprinter, reserveprinter]
activeprinter = 1
@sync(
for poem in poems, line in poem
activeprinter = (activeprinter % length(printers)) + 1
@async(
put!(printers[activeprinter].inputpath, line)
for prnline in printerspoem
while isreadyput!(prnprinters[activeprinter].errorpathinputpath, line)
end)
println(take!(prn.errorpath))
end)
for prn in printers
while isready(prn.errorpath)
println(take!(prn.errorpath))
end
end
Line 868 ⟶ 872:
schedulework([humptydumpty, oldmothergoose])
</lang>{{output}}<pre>
Humpty Dumpty sat on a wall.
Humpty Dumpty had a great fall.
Old Mother Goose,
All the king's horses and all the king's men,
When she wanted to wander,
Couldn't put Humpty together again.
Humpty Dumpty sat on a wall.
All the king's horses and all the king's men,
Old Mother Goose,
Would ride through the air,
On a very fine gander.
Jack's mother came in,
When she wanted to wander,
On a very fine gander.
And caught the goose soon,
Error: printer Reserve out of ink
4,105

edits