add the functions to use try to lock