File locking across fork() calls depends greatly upon your operating system's support of flock() (and, I suppose, fork()). You'll probably need to follow up with a bit more information about your environment and some code. (The alternative is that someone will make a wild guess that turns out to be right. If it were up to me, I'd say "don't flock before you fork".)