Merge "Properly unlock on return in process thread" into tm-dev