Process in parallel and output result to stdout theread-safely
Dr.No
jckj33 at gmail.com
Tue Sep 11 16:56:26 UTC 2018
On Monday, 10 September 2018 at 20:30:52 UTC, Dr.No wrote:
> On Saturday, 8 September 2018 at 14:26:45 UTC, ag0aep6g wrote:
>> [...]
>
> Yes, it does only happens at line breaks. I hadn't realized
> that until you mentioned. It does gets in place of \r and \n,
> that's why there's all in one line when this happens. Thankfor
> for the notice.
>
> [...]
I noticied this happens with everything I print in the loop, even
using C's printf:
> __gshared Mutex m;
> m = new Mutex();
> foreach(string fn; parallel(files))
> {
> try
> {
> auto res = f(fn);
> synchronized(m)
> {
> import std.c.stdio : printf;
> printf("hello!\n");
> }
>
> [...]
Output:
https://imgur.com/a/Mq9X4c3
More information about the Digitalmars-d-learn
mailing list