http://bugs.winehq.org/show_bug.cgi?id=9142
--- Comment #13 from Peter Dons Tychsen donpedro@tdcadsl.dk 2009-10-16 19:46:22 --- OK now is see the bug. Tricky!
I think the problem is in the wine-server:
1) wine-server opens all file with O_NONBLOCK. As described here: http://linux.die.net/man/2/fcntl, the O_NONBLOCK can result in a EAGAIN if there is a lock present.
2) EAGAIN is translated into a sharing violation in wine-server, and then it is game over.
EAGAIN makes sense on unix programs (who might understand it and try again), but i am not sure it makes that much sense for a windows program. I am not sure Windows has this concept. Therefore setting O_NONBLOCK might be incorrect.
The attached patch removes O_NONBLOCK, and allows Andrews example to work.
Removing O_NONBLOCK might have the side effect that it will take longer for dead network links to time-out, but i think this is OK as that actually emulates very well what happens on Windows (net time-outs take forever on windows).