what is the Windows equivalent of unix's flock(h, LOCK_SH)?

Solution 1:

LockFileEx for basic locking. For a very soft lock there are also opportunistic locks.