consumes lines in a file using posix threads and mutexes