add changes to mutex and thread to make it work with pintools