> structures are concerned. Something should probably be done with > blocking accesses to files, i.e. if one thread is read()ing from a file > descriptor which another wants to close, the first should get a signal or > something.
Bumping the count as suggested elsewhere is a much more elegant, scalable and self locking answer.