foreach(x; parallel(arr)) {
auto a = f(x);
auto res = g(a);
synchronized {
stdout.writeln(res);
stdout.flush();
}
}
Since f() and g() are some heavy functions, I'd like to process in parallel but the printing (doesn't need to respect order but must be thread-safe) hence I'm using synchronized. Is this counter-productive in any way?
