change thread class to use a Function object as the thread_func