U
Ulrich Sprick
Hi all,
I have a problem that should be quite common, but I'm not (yet) familiar with process synchronization in .NET:
There are several applications that write to a single file on disk. The apps open a FileStream with FileShare.None to prevent others
from reading garbage.
Now if a second process wants to open the file, it will fail. Currently I put the thread in a short Sleep and retry loop, but I'd
rather like to WaitForSingleObject() or so: The process 2 should be blocked until the first one closes the file and the file
(handle?) gets "signaled".
I came across the W32 Read/WriteFileEx(), which performs overlapped I/O, but I have a feeling that's a number too big...
Can anyone point me in the right direction?
Thanks a lot,
ulrich
I have a problem that should be quite common, but I'm not (yet) familiar with process synchronization in .NET:
There are several applications that write to a single file on disk. The apps open a FileStream with FileShare.None to prevent others
from reading garbage.
Now if a second process wants to open the file, it will fail. Currently I put the thread in a short Sleep and retry loop, but I'd
rather like to WaitForSingleObject() or so: The process 2 should be blocked until the first one closes the file and the file
(handle?) gets "signaled".
I came across the W32 Read/WriteFileEx(), which performs overlapped I/O, but I have a feeling that's a number too big...
Can anyone point me in the right direction?
Thanks a lot,
ulrich