Nautical bell: Difference between revisions

(→‎{{header|D}}: updated output of test run)
(→‎{{header|D}}: daemonize)
Line 11:
 
class NauticalBell : Thread {
private shared bool stopped; // shared?
 
this() {
Line 34:
if (next.minute == time.minute &&
next.hour == time.hour) {
immutable bells = (numBells == 1) ? "bell" : "bells";
writefln("%s : %d %s ", time, numBells, bells);
setNextBellTime();
}
Line 43:
}
 
void stop() pure nothrow {
this.stopped = true;
}
Line 50:
void main() {
auto bells = new NauticalBell();
//bells.isDaemon(true);
bells.start();
try {
bells.join();
} catch (ThreadException e) {
writeln(e.msg);
}
}</lang>
{{out}}
Anonymous user