I always just looped backwards through the file. That way you don’t have to worry about having exclusive access, and it’s pretty dang fast anyway. But if this is something you do a lot, maybe it’s worth the effort to get exclusive access (closing the file in every thread first).