Thread overview
Can someone help a Reddit user
Feb 20, 2018
bachmeier
February 20, 2018
Someone has posted a question on our subreddit. Would be nice if he could get an answer:
https://www.reddit.com/r/d_language/comments/7yxwvm/why_do_my_threads_write_to_the_wrong_file/
February 20, 2018
On 2/20/18 2:00 PM, bachmeier wrote:
> Someone has posted a question on our subreddit. Would be nice if he could get an answer:
> https://www.reddit.com/r/d_language/comments/7yxwvm/why_do_my_threads_write_to_the_wrong_file/ 
> 

I responded. Looks to me like a race condition in the DMC libc code, but I don't have an environment set up to test at the moment.

-Steve
February 21, 2018
On 2/20/18 2:52 PM, Steven Schveighoffer wrote:
> On 2/20/18 2:00 PM, bachmeier wrote:
>> Someone has posted a question on our subreddit. Would be nice if he could get an answer:
>> https://www.reddit.com/r/d_language/comments/7yxwvm/why_do_my_threads_write_to_the_wrong_file/ 
>>
> 
> I responded. Looks to me like a race condition in the DMC libc code, but I don't have an environment set up to test at the moment.

Wow, I didn't realize how bad DMC's FILE * was in terms of thread safety: http://bugzilla.digitalmars.com/issues/show_bug.cgi?id=327

I would highly recommend avoiding I/O on Win32, unless you are using Visual Studio libc, or using Windows handles directly. I can't believe it has been this bad and we haven't had mountains of bug reports on it.

-Steve