Click to See Complete Forum and Search --> : Two threads operating with files in one folder


Granite Golem
March 2nd, 2004, 08:49 AM
Hello all!

An interesting thing I found today, surely somebody knows about it.

I create two threads, where one (work) uses FindFirstChangeNotification - FindNextChangeNotification, finds a necessary file and notifies then the second (GUI) which must pick process this file and delete it. But when I try to open this file in the second thread, I can't do it - it returns "32" - "SHARING VIOLATION". What the ****? I close find handle, I call FindNextChangeNotification, but it doesn't work. At least, I caught that the system must have some time to release this file. So I added "Sleep(100)" before posting my message, and it solved the problem.

But what is time that the system needs to operate with files? More exactly - with seeking and notifying?