add helper function for pthread in class