added a public mutex lock to the threadManager