module pind.samples.ja.parallelism.parallelism_1; import std.stdio; import core.thread; struct Student { int number; void aSlowOperation() { writefln("The work on student %s has begun", number); // 長期の操作をシミュレートするためにしばらく待つ Thread.sleep(1.seconds); writefln("The work on student %s has ended", number); } } void main() { auto students = [ Student(1), Student(2), Student(3), Student(4) ]; foreach (student; students) { student.aSlowOperation(); } }