File access in threads

rmatthew

Centurion
Joined
Dec 30, 2002
Messages
115
Location
Texas
I have two threads that need to access the one file. One writes to it and one needs to move the file (esentially delete the file from it's current location and archive in a different directory).

Although I haven't seen it happen it would be possible that one thread is attempting to write while the other thread is trying to move the file.

Ideas?

Thanks in advance.
 
would [it] be possible that one thread is attempting to write while the other thread is trying to move the file[?]
Yes, absolutely. Either move both file operations to run consecutively on one thread, or create a [msdn=System.Threading.Mutex]mutex[/msdn] indicating that the file is being accessed.
 
Back
Top