Ali Çehreli:

Improve at will! :p

I will mostly just uniform its formatting to all the other Rosettacode entries, shorten the lines to 72 chars, etc.


                synchronized {
                    // Switch to the next printer
                    printers = printers[1..$];
                }

This doesn't work:

printers.popFront();


    void print(string line)
    {
        enforce(ink != 0, new OutOfInk);
        writefln("%s: %s", id, line);
        --ink;
    }
}

struct PrinterRendezvous
...
            try {
                synchronized {
(cast(Printer)printers.front).print(lines.front);
                }

It it a good idea to define Printer.print like this to remove that cast?

void print(string line) shared

Bye,
bearophile

Reply via email to