Made run_in_thread_pool use std::function.