Rendezvous: Difference between revisions
m
→{{header|Julia}}
Line 816:
line = take!(printer.inputpath)
linesprinted = 0
if
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
activeprinter = (activeprinter % length(printers)) + 1
@async(
for
end)
println(take!(prn.errorpath))▼
for prn in printers
while isready(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
|