ERROR_SHARING_VIOLATION when multithreading
Posted on 2013-01-11
Not quite sure which topic to use here, if it's a Windows7-problem or a general network problem.
I make a program that can run heavy calculations on several pcs connected (a little like SETI@home). It uses files as interface between processes. The program can run on different threads on the same machine. Almost.
It has been working fine for a long time on WinXP. But one beta-customer has problems with the new version (which introduces the hyperthreading) on Windows 7. On his machine, if I call:
for a file on the network at the same time from 2 different threads, none of them get access! Both get ERROR_SHARING_VIOLATION. On the network here at work that _never_ happens.
If I do the same with local files, everything is OK.
What can the difference be? Some access rights on this directory related to sharing?
Shouldn't one of them be the first anyway and get full access, while the next one can only read? As it is now, the file doesn't even get _copied_!
Are there any other more threadsafe ways to achieve this? I wouldn't like to rewrite the whole structure of the program.