Added filesystem lock and renamed/cleaned up thread.h and references to its fields