Define thread number
Implement mutex