Fixed non-boost implementation of locking
Merged with windows edits