https://issues.dlang.org/show_bug.cgi?id=13727
--- Comment #5 from Vladimir Panteleev <thecybersha...@gmail.com> --- (In reply to Steven Schveighoffer from comment #4) > Oh god! More locks :) Assuming we don't need to lock for the actual I/O operations (read/write), I think the impact for locking on some O(1)-ish operations shouldn't be too bad compared to the cost of the actual I/O. > I strongly believe we should fix the issue in DMC. Can we create a C++ > program that will exhibit the same issue? Yes: ///////////////////////////// test.c //////////////////////////// #include <windows.h> #include <stdio.h> DWORD WINAPI ThreadProc(LPVOID lpParameter) { for (int i=0; i<100; i++) { int res; FILE* f = fopen("test.c", "rb"); if (!f) { printf("fopen failed\n"); return 1; } res = fclose(f); if (res) { printf("fclose failed\n"); return 1; } } return 0; } void main() { for (int i=0; i<10; i++) { DWORD dwThreadId; CreateThread(NULL, 0, &ThreadProc, NULL, 0, &dwThreadId); } } ///////////////////////////////////////////////////////////////// --