in reply to Threading read access to a filedescriptor
Ignoring alternatives that force you to re-think your design fundamentally, I might suggest that you fork first, then open the file. Have each thread know how much of the file it's going to be reading, and what thread number it is, and then have it seek to the right spot in the file, find the next new line, and read until it passes the starting point for the next thread.
I have no idea how easy it will be to add all of this to the DBM file, though.
|
|---|