I'm writing a (very small) webserver in C language on Windows.
I need exclusive lock file both on reading and writing files, i've read msdn documentation about locking etc. and I've found the function LockFileEx
with the OVERLAPPED
structure and an Event hEvent
, I read also about how they work but the question is:
- In a web server we have lots of files, when a thread locks for example the file "test.txt"(exclusive lock) because for there was a request of this file, how can I synchronize another thread that wants to get the lock on the same file?
thank you.