added a mutex to pthreads_files