added an overloaded function for pthread cancel