in reply to Re: DB_Filelock issues
in thread DB_Filelock issues

Stevens explicitely states that file locks by the parent are not inherited by the child, without stating any differences between BSD and SysV.

You said, "don't flock() before you fork", but there's a (neat?) hack involving flocking before a fork to make sure a parent does something before a child can:

  1. flock a file exclusively.
  2. fork.
  3. let the child flock the file.
  4. now the parent can do her stuff.
  5. parent releases the flock.
  6. child releases the flock.
  7. both child and parent go their merry ways.
I was *this* close to actually use that trick (in a C program) earlier this week.

Abigail